# Boost only if multiple criteria are met

**URL:** <https://discuss.elastic.co/t/boost-only-if-multiple-criteria-are-met/256412>\
**Category:** Elasticsearch\
**Created:** [November 23, 2020, 9:59pm UTC](https://discuss.elastic.co/t/boost-only-if-multiple-criteria-are-met/256412 "2020-11-23T21:59:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![felipeecst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felipeecst/32/79530_2.png) [@felipeecst](https://discuss.elastic.co/u/felipeecst)\
**Post date:** [November 23, 2020, 9:59pm UTC](https://discuss.elastic.co/t/boost-only-if-multiple-criteria-are-met/256412/1 "2020-11-23T21:59:07Z")

</div>

I have the following ElasticSearch query:

```auto
        query: {
          bool: {
            must: [
              { match_all: {} }
            ],
            should: [
              { term: { company: { value: 'company', boost: 2 } } }
              { terms: { 'departments.id': 'company' } }
            ]
          }
        },
        sort: [
          '_score',
          { price: { order: 'desc' } }
        ]
      }

```

I want to boost if company term query matches, but I want to give an even bigger boost if and only if both the term query matches (company and department.ids).

How can I achieve that?

---

<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:** [December 21, 2020, 9:59pm UTC](https://discuss.elastic.co/t/boost-only-if-multiple-criteria-are-met/256412/2 "2020-12-21T21:59:11Z")

</div>

Closed on December 21, 2020, 9:59pm UTC

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