SELECT * FROM Customers WHERE City IN ('Paris','London')
How to convert above query in elasticsearch..
SELECT * FROM Customers WHERE City IN ('Paris','London')
How to convert above query in elasticsearch..
You may use terms query
GET _search
{
"query" : {
"terms" : {
"city" : ["Paris", "London"]
}
}
}
However, please make sure that your mapping has city marked as not_analyzed
In order to make your searches case insensitive, there are two ways I can think of :
match query instead of terms query. Terms query doesn't work on analyzed fields.A sample lowercase analyzer would look like this :
"analyzer": {
"lowercase_analyzer": {
"type": "custom",
"tokenizer": "keyword",
"filter": [
"lowercase",
"asciifolding"
]
}
}