I am new to elasticsearch. I am trying to write elasticsearch query to return either or values. Return results if statusfield == status1 or statusfield == status2. Below query is giving error
{
"query": {
"bool": {
"must": [
{
"match": {
"status": ["status1","status2"]
}
}
],
"must_not": [],
"should": []
}
}
}
CodePudding user response:
Use terms
which accepts an array of values instead of match
which doesn't
{
"query": {
"bool": {
"must": [
{
"terms": { <--- change this
"status": ["status1","status2"]
}
}
],
"must_not": [],
"should": []
}
}
}