Combining OR conditions

To find all of the products in the price range 10 to 13OR manufactured by valuesoft:

GET /amazon_products/_search
{
"query": {
"constant_score": {
"filter": {
"bool": {
"should": [
{
"range": {
"price": {
"gte": 10,
"lte": 13
}
}
},
{
"term": {
"manufacturer.raw": {
"value": "valuesoft"
}
}
}
]
}
}
}
}
}

Since we want to OR the conditions, we have placed them under should. Since we are not interested in the scores, we have wrapped our bool query inside a constant_score query.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset