# How to increase relevancy for duplicate documents?

**URL:** https://discuss.elastic.co/t/how-to-increase-relevancy-for-duplicate-documents/137689
**Category:** Elasticsearch
**Created:** [June 27, 2018, 8:18pm UTC](https://discuss.elastic.co/t/how-to-increase-relevancy-for-duplicate-documents/137689 "2018-06-27T20:18:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jmiller](https://avatars.discourse-cdn.com/v4/letter/j/d9b06d/32.png) [@jmiller](https://discuss.elastic.co/u/jmiller)
#### Post date: [June 27, 2018, 8:18pm UTC](https://discuss.elastic.co/t/how-to-increase-relevancy-for-duplicate-documents/137689/1 "2018-06-27T20:18:29Z")

</div>

TF-IDF is causing unwanted behavior for my query. I have a set of documents in the following format:

```
{
    "name": "brown fox",
    "description": "a sentence-long description"
}

```

Many documents have the same name with different descriptions. If I search something like to `brown fox`, I want to receive all documents with name `brown fox` because it is an exact match (or close to one).

Instead, the top hit is:

```
{
     "yellow dog",
     "the dog is not brown"
}

```

This document is the only one with `brown` in its description so the TF-IDF score for that match is high. Meanwhile both `brown` and `fox` match the other document, but the TF-IDF score is low because of the duplicates.

Any tips on how to increase the score of the `brown fox` documents?

* * *

Mapping: both fields are type `text` use the `standard` analyzer.

Query:

```
  dis_max:
      tie_breaker: 0.7
      queries:
          - match:
            name: "{{search_string}}"
          - match:
            description: "{{search_string}}"

```

* * *

I don't want to disable tf-idf on `name` because it helps in other search cases. Is it possible to either group together `name` and `description` for TF-IDF calculation so that a `brown` in `description` is not weighed higher than in `name`? Or is it possible to stop the duplicate document names from increasing docFreq?

Thank you for any help! Let me know if I left anything out.

---

<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 25, 2018, 8:18pm UTC](https://discuss.elastic.co/t/how-to-increase-relevancy-for-duplicate-documents/137689/2 "2018-07-25T20:18:30Z")

</div>

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