You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

As said before Search API has normalization of parameters and responses, this allows us to make one piece of code making a search request to an connection of type we don't know, to a engine we don't care about, and be sure it will work. 

To ease the process of creating generic request, Search API has different classes with well defined parameters

SearchRequest

This request is one of the parameters expected by engine methods (search, multi_search, async_search and knn_search). SearchRequest holds all the possible parameters this methods could need 

PropertyDescriptionDefaultTypeRequired
qQuery String"*"stringNo
queryAccepts the search query structure in the specific engine's format
objectNo
knnAccepts the knn search structure in the the specific engine's format
objectNo
rescoreThe query rescorer executes a second query only on the Top-K results returned. Expected in the specific engine's format
objectNo
sizeDefines the number of hits to return
integer (minimum: 0)No
startStarting document offset. Needs to be non-negative
integer (minimum: 0)No
scrollPeriod to retain the search context for scrolling
stringNo
sortEngine string definition or generic SortEntry defining the sort order
array of objectsNo
fetch_fieldsList of fields to return in the response based on field values
array of stringsNo
default_operatorThe default operator for the query string query: AND or OR"or"stringNo
highlightHighlighters enable you to get highlighted snippets from one or more fields in your search results so you can show users where the query matches are
objectNo
filtersTuple of engine-specific filters. The tuple must contain optional_negated_filters, optional_filters, required_negated_filters, required_filters
objectNo
agg_filtersTuple of engine-specific filters. The tuple must contain optional_negated_filters, optional_filters, required_negated_filters, required_filters
objectNo
aggsList of engine-specific aggregation implementations
objectNo
exclude_fieldsList of fields to exclude in the response based on field values
array of stringsNo

SortEntry

PropertyDescriptionTypeRequired
fieldName of the field which will be used for sortingstringYes
display_nameDisplay name for this sort entry. Only applicable for the user interfacestringNo
orderSort order to be used. It can be one of the predefined SortOrder values or a custom object with additional propertiesstring or objectYes

SortOrder

An enumeration.

ValueDescription
ascAscending sort order
descDescending sort order

SearchFilters

PropertyDescriptionDefaultTypeRequired
should_notFilter which will act as a boolean operator NOR[]array of objectsNo
shouldFilter which will act as a boolean operator OR[]array of objectsNo
must_notFilter which will act as a boolean operator NAND[]array of objectsNo
mustFilter which will act as a boolean operator AND[]array of objectsNo
post_should_notFilter which will act as a boolean operator NOR[]array of objectsNo
post_shouldFilter which will act as a boolean operator OR[]array of objectsNo
post_must_notFilter which will act as a boolean operator NAND[]array of objectsNo
post_mustFilter which will act as a boolean operator AND[]array of objectsNo
  • No labels