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

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": [
      "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


indeed. To quote the documentation

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.


1 Like

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