# Elasticsearch query with multiple fuzziness and weights

**URL:** https://discuss.elastic.co/t/elasticsearch-query-with-multiple-fuzziness-and-weights/336948
**Category:** Elasticsearch
**Created:** [June 27, 2023, 7:34am UTC](https://discuss.elastic.co/t/elasticsearch-query-with-multiple-fuzziness-and-weights/336948 "2023-06-27T07:34:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![alex.shmukler](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@alex.shmukler](https://discuss.elastic.co/u/alex.shmukler)
#### Post date: [June 27, 2023, 7:34am UTC](https://discuss.elastic.co/t/elasticsearch-query-with-multiple-fuzziness-and-weights/336948/1 "2023-06-27T07:34:33Z")

</div>

Hey Guys,  
I need to write query that will combine simple match and fuzziness together on different fields.  
At the beginning I need to normalize each field to characters and numbers only.  
Each field will have a different weight and if I have a match on the field I should use this weight. Then I need to return results that sum of their weights is \>= some value.  
Can someone assist me ?

Thanks,  
Alex

---

<div class="post-metadata">

### Author: ![alex.shmukler](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@alex.shmukler](https://discuss.elastic.co/u/alex.shmukler)
#### Post date: [June 27, 2023, 10:37am UTC](https://discuss.elastic.co/t/elasticsearch-query-with-multiple-fuzziness-and-weights/336948/2 "2023-06-27T10:37:33Z")

</div>

I will try explain it again:

Query should combine match and fuzziness together on different fields and each field should be normalized. For each field will be assigned a different weight and if there is a match on that field, I should use this weight for the document's total sum. Then I need to get documents with total sum \>= some value.

Is it possible ?

---

<div class="post-metadata">

### Author: ![alex.shmukler](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@alex.shmukler](https://discuss.elastic.co/u/alex.shmukler)
#### Post date: [June 30, 2023, 10:22am UTC](https://discuss.elastic.co/t/elasticsearch-query-with-multiple-fuzziness-and-weights/336948/3 "2023-06-30T10:22:18Z")

</div>

Solved it with the function\_score and some functions: boost\_mode: replace, score\_mode: sum and min\_score. Normalization done with analyzer.

---

<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 28, 2023, 10:23am UTC](https://discuss.elastic.co/t/elasticsearch-query-with-multiple-fuzziness-and-weights/336948/4 "2023-07-28T10:23:03Z")

</div>

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