# "more like this" not supporting "long" field type?

**URL:** https://discuss.elastic.co/t/more-like-this-not-supporting-long-field-type/76017
**Category:** Elasticsearch
**Created:** [February 22, 2017, 10:39am UTC](https://discuss.elastic.co/t/more-like-this-not-supporting-long-field-type/76017 "2017-02-22T10:39:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mlkmhd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mlkmhd/32/22385_2.png) [@mlkmhd](https://discuss.elastic.co/u/mlkmhd)
#### Post date: [February 22, 2017, 10:39am UTC](https://discuss.elastic.co/t/more-like-this-not-supporting-long-field-type/76017/1 "2017-02-22T10:39:15Z")

</div>

Hi,  
I have a field of type `long` and I want to search by `more_like_this` query. this is my query:

```
{
  "query": {
    "more_like_this": {
      "fields": [
        "title",
        "body",
        "lc"
      ],
      "like": [
        {
          "_index": "myIndex",
          "_type": "myType",
          "_id": "58abf6ab9c5600459a80d84e"
        }
      ],
      "min_term_freq": 1,
      "max_query_terms": 50
    }
  }
}

```

and the response:

```
{
    "error": {
        "root_cause": [
            {
                "type": "query_shard_exception",
                "reason": "failed to create query: {\n \"more_like_this\" : {\n \"fields\" : [\n \"title\",\n \"body\",\n \"jobTag\",\n \"jobType\",\n \"lc\"\n],\n \"like\" : [\n {\n \"_index\" : \"myIndex\",\n \"_type\" : \"job\",\n \"_id\" : \"58abf6ab9c5600459a80d84e\"\n }\n],\n \"max_query_terms\" : 50,\n \"min_term_freq\" : 1,\n \"min_doc_freq\" : 5,\n \"max_doc_freq\" : 2147483647,\n \"min_word_length\" : 0,\n \"max_word_length\" : 0,\n \"minimum_should_match\" : \"30%\",\n \"boost_terms\" : 0.0,\n \"include\" : false,\n \"fail_on_unsupported_field\" : true,\n \"boost\" : 1.0\n }\n}",
                "index_uuid": "z4vclzeBRFubOPfs3xc4EQ",
                "index": "myIndex"
            }
        ],

```

elasticsearch version: 5.2

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [February 27, 2017, 9:26am UTC](https://discuss.elastic.co/t/more-like-this-not-supporting-long-field-type/76017/2 "2017-02-27T09:26:51Z")

</div>

Hey,

indeed. To quote the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-mlt-query.html)

> The fields on which to perform MLT must be indexed and of type string. Additionally, when using like with documents, either \_source must be enabled or the fields must be stored or store term\_vector. In order to speed up analysis, it could help to store term vectors at index time.

--Alex

---

<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: [March 27, 2017, 9:27am UTC](https://discuss.elastic.co/t/more-like-this-not-supporting-long-field-type/76017/3 "2017-03-27T09:27:18Z")

</div>

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