Applying multi-select search
To search for more than one input value, use this feature.
The multi-select search provides an option to search for multiple values against a field. It
accepts values to match as an array of strings. All the values in the array are either excluded or
included during the match operation, based on the operator type. The
eq
operator
returns documents if the field value matches any one of the values that are passed in the input.
The ne
operator returns documents if the field does not have any of the values in
the input.Note: You can use the multi-select search only in combination with the
eq
and ne
operators. Also, you can use this feature only with fields that are not
analyzed. That is, you cannot apply multi-select search on the text
type
fields.In the following query, since the operator is
eq
, it fetches all the orders that
have OriginalTotalAmount
as either 30
or
600
.{
"query": {
"match": [
{
"condition": "MUST",
"field":"OriginalTotalAmount",
"valueOptions":["30","600"],
"operator":"eq"
}
]
}
}
Conversely, if you want to fetch all the orders that do not have
OriginalTotalAmount
as either 30
or 600
, use the
operator ne
.{
"query": {
"match": [
{
"condition": "MUST",
"field":"OriginalTotalAmount",
"valueOptions":["30","600"],
"operator":"ne"
}
]
}
}
When no operator is specified,
eq
is considered as the default operator, and the
following query behaves as an eq
query.{
"query": {
"match": [
{
"condition": "MUST",
"field":"OriginalTotalAmount",
"valueOptions":["30","600"]
}
]
}
}
The application is designed to prioritize the valueOptions
field over the
match
and value
fields. If you specify a range of values by using
the From
and To
fields, the application ignores the values that
are supplied for the match
, value
, and operator
fields.