I have two search terms "86746184549" and "3302093809". I am executing two separate term queries to fetch one document matching each of the ids.
"size":1,
"query":{
"term":{
"from_user_id": "86746184549"
}
}
and
"size":1,
"query":{
"term":{
"from_user_id": "3302093809"
}
}
Is there are a way to combine these 2 queries, something similar to what we do in facets.
{
"facets":{
"facet_1":{
},
"facet_2":{
},
"facet_3":{
}
}
}
I don't think the terms query will work here because, that wont return documents containing distinct from_user_id field.
The reason I want to combine the queries is because, say if I have 100 such terms then I will be making 100 calls!! to the elasticsearch server.
{"size":2,"query":{"terms":{"from_user_id": ["86746184549","333621309995644"]}}}, but this gave me 2 results containing the samefrom_user_id` value -> "86746184549". How do I fetch 2 records that contain the 2 distinctfrom_user_idvalues. I don't want to query the entire data set that's the reason why I have specifiedsizein the request body. Just want to fetch 2 records one containing "86746184549" and the other "333621309995644" in thefrom_user_idfield. `