# Is it possible to obtain results with different term queries that each could have a percentage weight?

**URL:** https://discuss.elastic.co/t/is-it-possible-to-obtain-results-with-different-term-queries-that-each-could-have-a-percentage-weight/275578
**Category:** Elasticsearch
**Created:** [June 10, 2021, 1:32pm UTC](https://discuss.elastic.co/t/is-it-possible-to-obtain-results-with-different-term-queries-that-each-could-have-a-percentage-weight/275578 "2021-06-10T13:32:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mstirling](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@mstirling](https://discuss.elastic.co/u/mstirling)
#### Post date: [June 10, 2021, 1:32pm UTC](https://discuss.elastic.co/t/is-it-possible-to-obtain-results-with-different-term-queries-that-each-could-have-a-percentage-weight/275578/1 "2021-06-10T13:32:16Z")

</div>

Does anyone know if it's possible to obtain results to use an alternative term search based on a percentage? For example Imagine I have an Apple index. I'd like to have 40% of the results to be color red while 60% to be color green? I don't think this is possible with`minimum_should_match`

Maybe something like

```auto
{
 "bool": {
          "should": [
            {
              "term": {
                "color": "red"
              },
            "minimum_should_match": 60%
            },
            {
              "term": {
                "color": "green"
              },
            "minimum_should_match": 40%
            }
          ]
        }
}

```

---

<div class="post-metadata">

### Author: ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)
#### Post date: [June 10, 2021, 8:25pm UTC](https://discuss.elastic.co/t/is-it-possible-to-obtain-results-with-different-term-queries-that-each-could-have-a-percentage-weight/275578/2 "2021-06-10T20:25:00Z")

</div>

No, there is no such option. You would need to run 2 queries with colors red and green and desired "size" and combine results on your client side.

One alternative thing you can do is to [collapse results](https://www.elastic.co/guide/en/elasticsearch/reference/current/collapse-search-results.html) based on the "color" field, and get top N inner hits for each color.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 8, 2021, 8:25pm UTC](https://discuss.elastic.co/t/is-it-possible-to-obtain-results-with-different-term-queries-that-each-could-have-a-percentage-weight/275578/3 "2021-07-08T20:25:50Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
