This page documents an earlier version of the API client. For the latest version, see Search multiple indices.
search
The returned results are broken down by query.
You can use up to 50 queries in a multiple queries request.
You can use this method for a search query or facet search by specifying the type
parameter to be default
or facet
.
This method can be useful in these scenarios:
- You have multiple indices that serve different purposes. This is typical when you want to search your main index as well as an index that contains a history of searches.
-
You want to target one index and send it multiple queries,
where, for example, each query contains different settings or filters,
or the query itself is slightly adjusted.
Use the
stopIfNotEnoughMatches
strategy to stop the search early.
When using the method
multiQueries
, the request isn’t tied to any specific index.
As a result, when retrieving logs for a specific index, multiQueries
logs won’t be retrieved.Examples
Multiple queries
Multiple queries and send extra HTTP headers
Parameters
A mapping of request options to send along with the query.
The strategy of the query.Can be one of the following values:
-
none
: Execute the sequence of queries until the end. This is recommended when each query is of equal importance, meaning all records of all queries need to be returned. -
stopIfEnoughMatches
: Execute queries one by one, but stop as soon as the cumulated number of hits is at leasthitsPerPage
. This is recommended when each query is an alternative, and where, if the first returns enough records, there is no need to perform the remaining queries.
Response
List of # in the order they were submitted, one element for each query.Example:
JSON
Response as JSON
This section shows the JSON response returned by the API. Each API client wraps this response in language-specific objects, so the structure may vary. To view the response, use thegetLogs
method.
Don’t rely on the order of properties—JSON objects don’t preserve key order.
JSON