Boost only if multiple criteria are met

I have the following ElasticSearch query:

        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?

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