I have an index with 19 mapped fields and I need to query it with query like this:
SELECT * FROM my-index WHERE field1 IN (value1, value2) AND field2 IN (valueX, valueY, valueZ) AND *anyOfThe19Fields* CONTAINS '2-f2d2cd00-8990-11ec-95bc-000d3a2d1528';
I really can't figure out how I can implement something like that with a single query.
I would appreciate your help, thx
CodePudding user response:
Based on your SQL query you need to use this elasticsearch query
{
"query": {
"bool": {
"must": [
{
"terms": {
"field1": [
"value1",
"value2"
]
}
},
{
"terms": {
"field2": [
"valueX",
"valueY",
"valueZ"
]
}
},
{
"multi_match": {
"query": "2-f2d2cd00-8990-11ec-95bc-000d3a2d1528"
}
}
]
}
}
}