Is it possible to count number of matches when using should filter based on custom weight values?

(Luger888) #1

For example, I have index pizzas. And I have Bool Filter

 "bool": {
      "should": {
          "toppings": [
              "query": "Tomatoes"
              "query": "Mushrooms"

Can ElasticSearch return match percentage for all pizzas in index, so all that have mushrooms XOR tomatoes, will return 50%, if both - 100%. And other toppings are irrelevant.

If yes, could we extend this functionality that way, so we could add for each topping weight value.
For example I'm interested in Tomatoes(50) , in Mushrooms(75) and Chili(100).
So in sum it will be 50 + 75 + 100 = 225
So Margherita has Tomatoes and Muchrooms = 125.
So this pizza match percentage should return near 56% ( 125/225).

I read ElasticSearch guide, read like hundred of times API docs, tried filters, queries, minimum_should_match, boost. I will really appreciate at least some direction where to search further.
Sorry if I placed my question not in right place.

(system) #2