Skip Scoring more than once if search term appears multiple time in Document

HI
Is it possible not to increase score if the search term appears in document more than once?
to implement similar to this ,which is implemented on db


            int rank = 100;
            var isMatched = false;
            if (!string.IsNullOrEmpty(field1) && field1.Contains(keyword))
            {
                rank = 1;
                isMatched = true;
            }
            else if (!string.IsNullOrEmpty(field2) && field2.Contains(keyword))
            {
                rank = 10;
                isMatched = true;
            }

Hi,

You can copy the text data fields used for your search with copy_to and keep only one occurrence of each token by using the unique token filter

https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-unique-tokenfilter.html

Phrase search won’t work on these fields.

Dominique

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