# More like this not working

**URL:** <https://discuss.elastic.co/t/more-like-this-not-working/204153>\
**Category:** Elasticsearch\
**Created:** [October 18, 2019, 1:52am UTC](https://discuss.elastic.co/t/more-like-this-not-working/204153 "2019-10-18T01:52:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rick\_Choo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rick_choo/32/55965_2.png) [@Rick\_Choo](https://discuss.elastic.co/u/Rick_Choo)\
**Post date:** [October 18, 2019, 1:52am UTC](https://discuss.elastic.co/t/more-like-this-not-working/204153/1 "2019-10-18T01:52:49Z")

</div>

Hi, following the more like this api document, I cannot get any returns even when I pass an exact term for search. Below is my code.

```
PUT /test
{
"mappings": {
        "properties": {
            "title": {
                "type": "text",
                "term_vector": "yes"
            },
            "description": {
                "type": "text"
            },
            "tags": {
                "type": "text",
                "fields" : {
                    "raw": {
                        "type" : "text",
                        "analyzer": "keyword",
                        "term_vector" : "yes"
                    }
                }
            }
        }
    }
}

POST /test/_doc
{
  "title":"test title",
  "description":"test description",
  "tag":"test tag"
}

GET /test/_search
{
"query": {
    "more_like_this" : {
        "fields" : ["title", "description"],
        "like" : "test",
        "min_term_freq" : 1,
        "max_query_terms" : 12
    }
}
}

GET /test/_search
{
"query": {
    "more_like_this" : {
        "fields" : ["title", "description"],
        "like" : "test title",
        "min_term_freq" : 1,
        "max_query_terms" : 12
    }
}
}
```

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 18, 2019, 9:04am UTC](https://discuss.elastic.co/t/more-like-this-not-working/204153/2 "2019-10-18T09:04:58Z")

</div>

Hi Rick.

It's fussy about not having super-rare indexed terms too. Ordinarily "more" would mean using words that are known to exist in documents other than your example one. So for your example you'll need to add

```
"min_doc_freq": 1
```

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 18, 2019, 3:45pm UTC](https://discuss.elastic.co/t/more-like-this-not-working/204153/3 "2019-10-18T15:45:31Z")

</div>

To take more control over how matching works you might be interested in [this alternative](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-mlt-query.html#_alternative) recently added to the 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:** [November 15, 2019, 3:45pm UTC](https://discuss.elastic.co/t/more-like-this-not-working/204153/4 "2019-11-15T15:45:31Z")

</div>

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