# Decrease score when field has additional values

**URL:** <https://discuss.elastic.co/t/decrease-score-when-field-has-additional-values/330341>\
**Category:** Elasticsearch\
**Created:** [April 20, 2023, 3:38am UTC](https://discuss.elastic.co/t/decrease-score-when-field-has-additional-values/330341 "2023-04-20T03:38:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattG1](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@MattG1](https://discuss.elastic.co/u/MattG1)\
**Post date:** [April 20, 2023, 3:38am UTC](https://discuss.elastic.co/t/decrease-score-when-field-has-additional-values/330341/1 "2023-04-20T03:38:52Z")

</div>

Hey, is it possible to decrease a score when a field has more values than is being matched for?

```auto
const documents = [
  {
    id: 1,
    tags: ['a', 'b'],
  },
  {
    id: 2,
    tags: ['a'],
  },
];

const query = {
  bool: {
    should: [
      {
        term: {
          tag: 'a',
        },
      },
    ],
  },
};

```

Given the data above, when I run a query like this, I receive both results (expected) however they have identical scores.

I would like for the document which has `id: 2` to have a higher score because it matches more precisely than the document with `id: 1`. Is this possible?

Thanks,  
Matt

---

<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:** [May 18, 2023, 3:39am UTC](https://discuss.elastic.co/t/decrease-score-when-field-has-additional-values/330341/2 "2023-05-18T03:39:12Z")

</div>

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