elasticsearchelastic-stackelasticsearch-6morelikethis

more_like_this is not working for repeated same text in field


We are using elasticsearch 6.0 to find out similar components in the elasticsearch index. we are using more_like_this for that. the repeated text in the field is not given proper result

1) 1st component field have text like this:

fan fan fan in the room

2) 2nd component field have text like this:

one two three fan fan fan in the room.

when I try to find out similar components like 1st components, then elk is not showing any result.

How I can get elasticsearch result which will work for repeated text as well as a unique word in the field.

Note:-We will not able to add min_term_freq.


Solution

  • By default min_doc_freq is 5, So your query is not working because your index doesn't contain at least 5 documents whose term property holds yellow. So, set min_doc_freq to 1 in your query and it should work.

    {
        "query": {
            "more_like_this": {
                "like": "Hello",
                "min_term_freq": 1,
                "min_doc_freq": 1
            }
        }
    }
    

    For reference we can go Elasticsearch More Like this no result