Wrapper endpoint for the type-ahead pipeline, each endpoint will call a pipeline under the hood, the advantage of this approach, is the possibility of documenting the  input and output of the pipeline, as well as the possibility of hot updated 


Execute Get Typeahead

This endpoint serves as a GAIA API and acts as a wrapper for a specific pipeline "typeahead". It executes the search with the provided parameters.

Parameters

ParameterTypeDescription
qstringString query to execute in the search engine
fromintegerStart position for retrieving hits
pageintegerStart page for retrieving hits. Minimum page is 1. Not applicable when from is being used
fetch_fieldsarrayList of fields to return in the response based on field values
scrollstringPeriod to retain the search context for scrolling
default_operatorstringThe default operator for the query string query: AND or OR
exclude_fieldsarrayList of fields to exclude in the response based on field values

Example

GET /es/api/v1/typeahead/?q=query&from=0&fetch_fields=field1,field2&scroll=1m

Response

Successful Response [200]

{
  "took": 29,
  "timed_out": false,
  "total": 87,
  "max_score": 9.226555,
  "hits": [...]
}

Validation Error [422]

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Execute Post Typeahead

This endpoint serves as a GAIA API and acts as a wrapper for a specific pipeline "typeahead". It executes the search with the provided parameters.

Parameters

Name

Type

Description

Required

qstringString query to execute in the search engineNo
sizeintegerNumber of hits to return per requestNo
fromintegerStart position for retrieving hitsNo
pageintegerStart page for retrieving hits. Minimum page is 1. Not applicable when from is being usedNo
fetch_fieldsarrayList of fields to return in the response based on field valuesNo
scrollstringPeriod to retain the search context for scrollingNo
default_operatorstringThe default operator for query string query: AND or ORNo
exclude_fieldsarrayList of fields to exclude in the response based on field valuesNo


Example

POST /es/api/v1/typeahead/

{
  "q": "query",
  "size": 10,
  "from": 0,
  "fetch_fields": ["field1", "field2"],
  "scroll": "1m"
}

Response

Successful Response [200]

{
  "took": 29,
  "timed_out": false,
  "total": 87,
  "max_score": 9.226555,
  "hits": [...]
}

Validation Error [422]

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}