- Search for exact values: search for exact values or ranges of numbers, dates, IPs, or strings.
- Full-text search: use full text queries to query unstructured textual data and find documents that best match query terms.
- Vector search: store vectors in AIMP and use approximate nearest neighbor (ANN) to find vectors that are similar, supporting use cases like semantic search.
Query results are returned in the following format:
Example query request to AIMP is as follows:
python
score, and it is calculated based on BM25 algorithm for full-text search
and a configured similarity metric for vector search.
Query string query
AIMP supports a simple query string query that uses the Lucene Query Syntax to search documents. Specifically,term, phrase, wildcard, boolean operators, range operators, and special character escaping are supported.
A query to an index with
object field type requires special handling.
An example index mappings:
Vector query
A k-nearest neighbor (kNN) search finds the k nearest vectors to a query vector, as measured by a similarity metric.
An example vector query:
Boolean query
A query that matches documents matching boolean combinations of other queries. The boolean query maps to Lucene BooleanQuery. It is built using one or more boolean clauses, each clause with a typed occurrence. The occurrence types are:
Below is an example of a boolean query:
NODE and have the highest score value.
occur parameter is optional and defaults to should.Boost query
Boost values that are less than one will give less importance to this query compared to other ones while values that are greater than one will give more importance to the scores returned by this query.The boost value must be greater than zero.
Hybrid query
You can mix the aforementioned queries with a vector query to get better relavance. An example hybrid query:bool query, performing a hybrid query
that combines a queryString and a knn.
The score of documents matching in the queryString is boosted by 0.7 during the calculation.
In the knn, a pre-filtering is performed using a filter, followed by a vector query
that calculates the scores of the top 5 most similar documents with a boost of 0.3.
Sort search results
AIMP allows you to add one or more sorts on specific fields. Each sort can be reversed as well. The sort is defined on a per field level.Sorting can be done on the following data types:
longdoubledatetime
asc: sorts in ascending orderdesc: sorts in descending order
trackScores to true,
scores will still be computed and tracked.
Query limits
The query result size is affected by the dimension of the vectors and
whether vector values are included in the result.