Query DSL¶
Nixiesearch has a Lucene-inspired query DSL with multiple search operators.
Note
To search over a field, make sure that this field is marked as searchable in index mapping.
Unlike Elastic/OpenSearch query DSL, Nixiesearch has a distinction between search operators and filters:
- Search operators affect document relevance scores (like semantic and match)
- Filters only control how we include/exclude documents. See Filters for more details.
Search request format¶
Search request format is similar to existing Lucene-based search engines:
{
"query": {
"match_all": {}
},
"fields": ["title", "desc"],
"size": 10,
"aggs": {
"color_counts": {"term": {"field": "color"}}
},
"filters": {
"include": {"term": {"field": "category", "value": "pants"}}
}
}
Where fields are:
query
: required, a search query operator.fields
: optional (default: all stored fields), which document fields to return in the response payload. Note that these fields should be marked asstore: true
in index mapping.size
: optional (default: 10), number of documents to returnaggs
: optional, facet aggregations, see Facets for more examples.filters
: optional, include/exclude filters to select a sub-set of documents for searching.
Search operators¶
Search operators allow you to actually perform the full-text search over your documents. They're designed to be fast and quickly get top-N most relevant document for your search query.
Nixiesearch supports the following search operators:
- match: search over a single field
- multi_match: search over multiple fields at once.
- match_all: match all documents.
- semantic: embed a query and perform a-kNN vector search over document embeddings.
- knn: perform a-kNN vector search over document embeddings (without embedding the query).
Operators can be combined into a single query:
- dis_max: search over multiple fields, but sort by the most matching field score.
- bool: combine multiple queries in a boolean expression.
Note
All search operators can be combined with filters to search over a subset of documents.
Ranking operators¶
Rank operators accept one or more search operators but only operate on top-N of them.
Nixiesearch supports the following list of rank operators:
- RRF: Reciprocal Rank Fusion, merge two search results lists based on document position.