# Indexing weighted terms (or fake term frequency)

**URL:** <https://discuss.elastic.co/t/indexing-weighted-terms-or-fake-term-frequency/248034>\
**Category:** Elasticsearch\
**Created:** [September 9, 2020, 3:21pm UTC](https://discuss.elastic.co/t/indexing-weighted-terms-or-fake-term-frequency/248034 "2020-09-09T15:21:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hannes\_Korte](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hannes_korte/32/909_2.png) [@Hannes\_Korte](https://discuss.elastic.co/u/Hannes_Korte)\
**Post date:** [September 9, 2020, 3:21pm UTC](https://discuss.elastic.co/t/indexing-weighted-terms-or-fake-term-frequency/248034/1 "2020-09-09T15:21:09Z")

</div>

Hi,

I am looking for a way to fake the frequency of terms in a field at index time. It's kind of a boost for a specific term in a specific document.

Imagine your docs are people with each having a map of weighted skills, e.g.:

```auto
{
    "id": "A1",
    "name": "John",
    "skills": {
        "programming/kotlin": 0.8,
        "programming/java": 0.5,
        "sports/handball": 0.2,
        "sports/climbing": 0.1,
    }
}

```

The list of skills is quite long, so it is impossible to store each one in a separate field. My naive solution is to discretize the skill terms, like:

```auto
{
    "id": "A1",
    "name": "John",
    "skillTerms": [
        "programming/kotlin", "programming/kotlin", ... (8x)
        "programming/java", "programming/java", ... (5x)
        "sports/handball", "sports/handball",
        "sports/climbing"
    }
}

```

This way I can simply do a term query for "programming/kotlin" to get this person ranked higher than another one with a lower weight for this skill (at least approximately). The downside is the unnecessarily large size of the documents due to the obvious redundancy.

Can you think of any other less hacky solution? Maybe by using something like the copy\_to mapping option with a count parameter? Or is there any plugin to fake the term frequency?

Thanks

---

<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:** [October 7, 2020, 3:21pm UTC](https://discuss.elastic.co/t/indexing-weighted-terms-or-fake-term-frequency/248034/2 "2020-10-07T15:21:14Z")

</div>

Closed on October 7, 2020, 3:21pm UTC

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