I am trying to filter _id field (index not enabled) in elasticsearch by range. Is it possible? If so, how it can be done? I've read in elasticsearch documentation that we can use 'ids' to query by _id and type, but I can't see how it can be done with range filter. (I don't want to enable index on _id).
{
"from": 0,
"size": 20,
"query": {
"match_all": {}
},
"filter": {
"range": {
"_id": {
"gt": "51f7b6b7710c42b136027581"
}
}
},
"sort": {
"pubdate": {
"order": "desc"
}
}
}
Maybe it's a little late, but I try to answer and maybe the answer is still usefull for you.
Seen the comments done for collegues, I think that two main ideas can be extracted:
So, I've coded an example to check if solution 2 is possible. Key parts are these:
Once you have indexed the
id
field, you can filter by it as you wish.range
filter is one of themYou can see a working example in this notebook