# More Like This Query not giving any hits

**URL:** <https://discuss.elastic.co/t/more-like-this-query-not-giving-any-hits/39519>\
**Category:** Elasticsearch\
**Created:** [January 19, 2016, 9:21am UTC](https://discuss.elastic.co/t/more-like-this-query-not-giving-any-hits/39519 "2016-01-19T09:21:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pewpewlasers](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@pewpewlasers](https://discuss.elastic.co/u/pewpewlasers)\
**Post date:** [January 19, 2016, 9:21am UTC](https://discuss.elastic.co/t/more-like-this-query-not-giving-any-hits/39519/1 "2016-01-19T09:21:29Z")

</div>

I recently upgraded to 2.1 and I am trying to use the new more like this query without any luck. My code looks something like this:

```
  function_score: {
     functions: [...],
       query: {
           bool: {
             must: [{
                            more_like_this : {
                                fields : ['title', 'desc'],
                                like : [
                                    {
                                        "_index" : "myindex",
                                        "_type" : "mytype",
                                        "_id" : "uniqueid"
                                    }
                                ],
                                min_term_freq : 1,
                                max_query_terms : 12
                            }
                        }],
             must_not: [...],
             should: [...],
             filter: [...],
          },
       },
    }
```

---

<div class="post-metadata">

**Author:** ![mikemccand](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mikemccand](https://discuss.elastic.co/u/mikemccand)\
**Post date:** [January 19, 2016, 3:28pm UTC](https://discuss.elastic.co/t/more-like-this-query-not-giving-any-hits/39519/2 "2016-01-19T15:28:55Z")

</div>

Try simplifying your query (remove the `bool` and run only the `more_like_this`)?

If you pass a canned string as the `like` instead of referencing an already indexed document, does it work?

---

<div class="post-metadata">

**Author:** ![pewpewlasers](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@pewpewlasers](https://discuss.elastic.co/u/pewpewlasers)\
**Post date:** [January 19, 2016, 4:54pm UTC](https://discuss.elastic.co/t/more-like-this-query-not-giving-any-hits/39519/3 "2016-01-19T16:54:38Z")

</div>

Yes anything else is working fine, I was using multi match (cross fields) for text searches. However, for this particular task I need to search documents similar to a particular document. Don't know why this is not working. In version 1.4 I think it was working fine with the filtered api.

---

<div class="post-metadata">

**Author:** ![sandros](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandros/32/6348_2.png) [@sandros](https://discuss.elastic.co/u/sandros)\
**Post date:** [January 20, 2016, 10:25am UTC](https://discuss.elastic.co/t/more-like-this-query-not-giving-any-hits/39519/4 "2016-01-20T10:25:57Z")

</div>

I got something similar to work with the keys in a bit a different order and also I think it is better to use ids instead of like (following docs I also thought that I needed like, but did not get it to work till I used ids). My working example in a python dict is the following, where I do a bool query with more\_likeThis with own rescoring as one must clause an matching another field as another must clause:  
`{'query': {'bool': {'must': [{'function_score': {'functions': [{'filter1':11,[..]},{'filter2':22,[..]}], 'query': {'more_like_this': { 'fields': ["myfields"] 'ids': 123,#instead of like 'max_query_terms': 52, 'min_term_freq': 2, 'minimum_should_match': '25%', 'stop_words':[..]}} 'score_mode': '..' }}, {'terms': {'myspecialField: ['matchThis']}}]}}}`

---

<div class="post-metadata">

**Author:** ![pewpewlasers](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@pewpewlasers](https://discuss.elastic.co/u/pewpewlasers)\
**Post date:** [January 21, 2016, 9:38am UTC](https://discuss.elastic.co/t/more-like-this-query-not-giving-any-hits/39519/5 "2016-01-21T09:38:10Z")

</div>

Seems to be working somewhat but it is giving me unexpected results. The matches don't look accurate.

---

<div class="post-metadata">

**Author:** ![sandros](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandros/32/6348_2.png) [@sandros](https://discuss.elastic.co/u/sandros)\
**Post date:** [January 21, 2016, 10:27am UTC](https://discuss.elastic.co/t/more-like-this-query-not-giving-any-hits/39519/6 "2016-01-21T10:27:51Z")

</div>

Could it be due to the params you give to more like this? I found it very useful to check what this query actually does via using validate, see more like this exple [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-validate.html#_request_parameters_3). For instance I could imagine that  
`min_term_freq : 1, max_query_terms : 12`  
could imply that you have only VERY specific terms to the mother-document to be matched by other docs

---

<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 5, 2017, 11:22pm UTC](https://discuss.elastic.co/t/more-like-this-query-not-giving-any-hits/39519/7 "2017-07-05T23:22:36Z")

</div>


