# Elastic score decay if field tokens are in another field

**URL:** https://discuss.elastic.co/t/elastic-score-decay-if-field-tokens-are-in-another-field/316037
**Category:** Elasticsearch
**Created:** [October 7, 2022, 6:59am UTC](https://discuss.elastic.co/t/elastic-score-decay-if-field-tokens-are-in-another-field/316037 "2022-10-07T06:59:22Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Sergey\_V](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey_v/32/111785_2.png) [@Sergey\_V](https://discuss.elastic.co/u/Sergey_V)
#### Post date: [October 7, 2022, 6:59am UTC](https://discuss.elastic.co/t/elastic-score-decay-if-field-tokens-are-in-another-field/316037/1 "2022-10-07T06:59:22Z")

</div>

Hi! Me need decrease score of document if in "field1" has tokens of "field2".  
Tell me how can this be done?

---

<div class="post-metadata">

### Author: ![xeraa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xeraa/32/48181_2.png) [@xeraa](https://discuss.elastic.co/u/xeraa)
#### Post date: [October 7, 2022, 5:53pm UTC](https://discuss.elastic.co/t/elastic-score-decay-if-field-tokens-are-in-another-field/316037/2 "2022-10-07T17:53:51Z")

</div>

That sounds more like an Elasticsearch question and I'll move the post. Also, how would the formula for the score look like? If that's a frequent query, I think you want to do some calculation at index-time already for that overlap (if it's independent of the query — your details are a bit vague there).

---

<div class="post-metadata">

### Author: ![Sergey\_V](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey_v/32/111785_2.png) [@Sergey\_V](https://discuss.elastic.co/u/Sergey_V)
#### Post date: [October 10, 2022, 7:28am UTC](https://discuss.elastic.co/t/elastic-score-decay-if-field-tokens-are-in-another-field/316037/3 "2022-10-10T07:28:19Z")

</div>

I do search for organizations.  
The organization has a field with name of company and a field with the founders.  
Search is conducted together on these fields. But name of founder can contain the same tokens as the name of the company. In this case, I do not need to increase the assessment of the document for the founder field. Therefore, the parent company will be valued lower than the companies in which it is the founder

---

<div class="post-metadata">

### Author: ![xeraa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xeraa/32/48181_2.png) [@xeraa](https://discuss.elastic.co/u/xeraa)
#### Post date: [October 11, 2022, 1:08am UTC](https://discuss.elastic.co/t/elastic-score-decay-if-field-tokens-are-in-another-field/316037/4 "2022-10-11T01:08:05Z")

</div>

When you say "parent company", does that mean we are talking across documents? Because that would be a totally different problem again than making that decision within a single document.

---

<div class="post-metadata">

### Author: ![Sergey\_V](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey_v/32/111785_2.png) [@Sergey\_V](https://discuss.elastic.co/u/Sergey_V)
#### Post date: [October 25, 2022, 7:38am UTC](https://discuss.elastic.co/t/elastic-score-decay-if-field-tokens-are-in-another-field/316037/5 "2022-10-25T07:38:12Z")

</div>

No, all this data is in one document.  
Example of part document:

```auto
company: {
 shortName: "OOO Ivan"
 ceo: "Ivan Ivanov"
}

```

If `shortName` tokens has in `ceo` tokens, then score `ceo` not needed.

---

<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: [November 22, 2022, 7:38am UTC](https://discuss.elastic.co/t/elastic-score-decay-if-field-tokens-are-in-another-field/316037/6 "2022-11-22T07:38:30Z")

</div>

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