How To Have Range And Match Query In One Elastic Search Query Using Python?
I have to find the matching documents which have the string, for example: 'sky', within some 'key' range. When I write separate match and range query, I get the output from the ES
Solution 1:
You need to do it like this using a bool/must
query
res = es.search(index="dummy", body={
"from": 0,
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"key": {
"gte": "1000"
}
}
},
{
"match": {
"word": "sky"
}
}
]
}
}
})
Post a Comment for "How To Have Range And Match Query In One Elastic Search Query Using Python?"