Skip to main content

Keyword Search

BM25 keyword search over text indexes. See Keyword Search for the concepts, consistency modes and query syntax.

List text indexes​

GET /api/v1/text-indexes

curl https://api.rushdb.com/api/v1/text-indexes \
-H "Authorization: Bearer $RUSHDB_API_KEY"
{
"data": [
{
"name": "Article.body.text",
"label": "Article",
"property": "body",
"consistency": "eventual",
"status": "ready",
"pending": 0
}
],
"success": true
}

Create a text index​

POST /api/v1/text-indexes

FieldTypeRequiredDescription
labelstringyesLabel of the records to index.
propertystringyesA property name, or * for every string of the record.
namestringnoUnique within the project. Defaults to <label>.<property>.text (all in place of *).
consistencystringno"eventual" (default) or "immediate".
curl -X POST https://api.rushdb.com/api/v1/text-indexes \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"label": "Article", "property": "body"}'

The index is built online: status is building until it turns ready.

POST /api/v1/text-indexes/name-suggestion with label and property returns { "name": ... }, the default name a new index would get.

Drop a text index​

DELETE /api/v1/text-indexes/:name

curl -X DELETE https://api.rushdb.com/api/v1/text-indexes/Article.body.text \
-H "Authorization: Bearer $RUSHDB_API_KEY"

POST /api/v1/search/text

FieldTypeRequiredDescription
querystringyesKeywords; a blank query matches nothing.
indexstringnoThe text index, by name. Otherwise the one ready text index of the first label.
propertystringnoNarrows the choice of text index to one over this property.
labelsarray of stringsnoLabels to search within.
whereobjectnoFilter applied before ranking.
skipnumbernoResults to skip (default 0).
limitnumbernoMaximum results (default 10).
allTermsbooleannoEvery unmarked keyword must match.
phrasebooleannoMatch the keywords as one phrase.
curl -X POST https://api.rushdb.com/api/v1/search/text \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "graph database", "labels": ["Article"], "limit": 10}'
{
"data": [
{ "__id": "0192f0c4-7a1e-7b8a-9c3d-2f6e5a4b3c21", "__label": "Article", "__score": 2.41, "title": "Graph databases explained" }
],
"total": 1,
"meta": { "textSearch": { "matches": 1, "pending": 0 } },
"success": true
}

total counts every match, not only the page. meta.textSearch.pending is how many changes the index had not applied when the search ran.