I've got the following elastic search (0.90)
query which return hits based on the id
field with combinations of OR
operator between them. It's working perfectly.
$query = '{
"fields": "position",
"query": {
"query_string": {
"query": "id:rs6663158 id:rs6695131",
"default_operator": "OR"
}
}
}';
I wish to do the same with a much simpler query and I found the term
option and I have the following which is working fine:
$query = '{
"fields": "position",
"query": {
"term": {
"id": "rs6663158",
"default_operator": "OR"
}
}
}';
I'm not sure how to add more than 1 id
field like: "id": ["rs6663158", "rs7221234"]
. Is it possible to do this with term
option, if not is there any other better and simpler solution?
Using the terms
query, like this
$query = '{
"fields": "position",
"query": {
"terms": {
"id": ["rs6663158", "rs6695131"]
}
}
}';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.