Query

Query results from index with index_id The following parameters are supported:

  • Result type
  • Result sorting
  • Realtime search
  • Field filter
  • Fields to include in search results
  • Distance fields: derived fields from distance calculations
  • Highlights: keyword-in-context snippets and term highlighting
  • Query facets: which facets fields to calculate and return at query time
  • Facet filter: filter facets by field and value
  • Result sort: sort results by field and direction
  • Query type default: default query type, if not specified in query
post/api/v1/index/{index_id}/query

Request

Path parameters

index_idinteger required

index id

Headers

apikeystring required

YOUR_SECRET_API_KEY

Request body

query_stringstring

Query string, search operators + - "" are recognized.

enable_empty_queryboolean

Enable empty query: if true, an empty query string iterates through all indexed documents, supporting the query parameters: offset, length, query_facets, facet_filter, result_sort, otherwise an empty query string returns no results. Typical use cases include index browsing, index export, conversion, analytics, audits, and inspection.

offsetinteger

Offset of search results to return.

lengthinteger

Number of search results to return. With length=0, resultType::TopkCount will be automatically downgraded to resultType::Count, returning the number of results only, without returning the results itself.

result_type'Count' | 'Topk' | 'TopkCount'

The following result types are supported:

  • Count (count all results that match the query, but returning top-k results is not required)
  • Topk (returns the top-k results per query, but counting all results that match the query is not required)
  • TopkCount (returns the top-k results per query + count all results that match the query)
include_uncommittedboolean

True real-time search: include indexed, but uncommitted documents into search results.

field_filterstring[]

Specify field names where to search at query time, whereas SchemaField.indexed is set at index time. If empty then all indexed fields are searched. Field filters are active during vector and lexical search.

query_type_default'Union' | 'Intersection' | 'Phrase' | 'Not'

Specifies the default QueryType: The following query types are supported:

  • Union (OR, disjunction),
  • Intersection (AND, conjunction),
  • Phrase (""),
  • Not (-).

The default QueryType is superseded if the query parser detects that a different query type is specified within the query string (+ - "").

Example request

{
  "length": 10,
  "field_filter": [
    "title"
  ],
  "result_sort": [
    {
      "field": "date",
      "order": "Ascending",
      "base": "None"
    }
  ]
}

Response

Results found, returns the SearchResultObject

original_querystring required

Search query string

querystring required

Search query string after any automatic query correction or completion

query_termsstring[] required

Vector of search query terms. Can be used e.g. for custom highlighting.

offsetinteger required

Offset of the returned search results

lengthinteger required

Number of requested search results

countinteger required

Number of returned search results. Identical to results.len()

count_totalinteger required

Total number of search results that match the query count_total is only accurate if result_type=TopkCount or ResultType=Count, but not for ResultType=Topk

observed_vector_countinteger required

number of vectors observed during search

observed_cluster_countinteger required

number of clusters observed during search

documentsobject[] required

Vector of search result documents

facetsobject required

List of facet fields: field name and vector of unique values and their counts. Unique values and their counts are only accurate if result_type=TopkCount or ResultType=Count, but not for ResultType=Topk

suggestionsstring[] required

Suggestions for auto complete and spelling correction.

timeinteger required

Time taken to execute the search query in nanoseconds

Changes

    • breaking

      removed subschema #2 subschema #3 subschema #4 from the request property oneOf list

    • breaking

      removed 'propertyNames' constraint from the / response property for the status

    • warning

      removed the request property

    • warning

      removed the request property

    • warning

      removed the request property

    • warning

      removed the request property

    • warning

      removed the request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      the request property // became optional

    • info

      the request property default value was added

    • info

      the request property default value was added

    • info

      the request property default value was added

    • info

      the request property default value SearchOnly was added

    • info

      the request property default value Union was added

    • info

      the request property default value was added

    • info

      the request property default value TopkCount was added

    • info

      the request property default value Lexical was added

    • info

      added subschema #2 to the request property oneOf list

    • info

      added subschema #2 subschema #3 subschema #4 to the request property oneOf list

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      api operation id query_index_api_post removed and replaced with query_index_post