I have the following mappings in my elasticsearch index
{
"test-index" : {
"mappings" : {
"properties" : {
"factor" : {
"type" : "long"
},
"price_range" : {
"type" : "integer_range",
"doc_values" : false
},
// other_fields
}
}
}
}
}
The elasticsearch query is an AND query where there will be conditions for "other_fields" and price. Price will need to be calculated on the fly. I want to use the value of "factor" to calculate the price and then match the price with the "price_range" field. Here are the matching conditions:
- If "price_range" is indexed, use "factor" to calculate the price and match against "price_range"
- If "price_range" is indexed but "factor" is not, use a default value for factor and match against "price_range"
- If "price_range" is not indexed, ignore price calculation
Please let me know how can I go about this. Thanks!