I have a list, id_list = [1, 3, 5, 7]
I need to fetch data from elasticsearch corresponding to the ids present in id_list, similar to id__in
that we do for postgres.
I was trying to find a way using elasticsearch_dsl.Search()
, but I am stuck at it. Any help with the code or relevant documentation will be very helpful.
You can use terms query to perform "in"
query in elasticsearch
Try out the below query
{
"query": {
"terms": {
"id_list": [
1,
3,
5,
7
]
}
}
}