More_like_this via Nest for document results in 500 error from ES 6.2.2

We upgraded from ES 5.6 to ES 6.2.2 and started having an issue using .NET Nest 6.1.0 to call ES for more_like_this queries. This use to work against ES 5.6 but fails with ES 6.2.2.

The more_like_this are done via document and it appears the "_id" field is serialized into the request as with null for value. This results in the below error.

Example call.

{
  "size": 250,
  "sort": [
    {
      "_score": {
        "order": "desc"
      }
    }
  ],
  "_source": {
    "includes": [
      "mypkid"
    ]
  },
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "must": [
            {
              "more_like_this": {
                "fields": [
                  "mytitle",
                  "mybody",
                  "myalttext"
                ],
                "like": [
                  {
                    "_index": "myindex",
                    "_type": "mydoctype",
                    "_id": null,
                    "doc": {
                      "altfkid": 0,
                      "mytitle": "title goes here",
                      "fkid": 0,
                      "mybody": "document text goes here",
                      "myalttext": "alt text goes here"
                    }
                  }
                ]
              }
            }
          ]
        }
      },
      "functions": [
        {
          "filter": {
            "multi_match": {
              "query": "look for these words",
              "fields": [
                "myalttext",
                "mytitle"
              ]
            }
          },
          "weight": 1
        }
      ]
    }
  }
}

Error result.

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_state_exception",
                "reason": "Can't get text on a VALUE_NULL at 1:290"
            }
        ],
        "type": "illegal_state_exception",
        "reason": "Can't get text on a VALUE_NULL at 1:290"
    },
    "status": 500
}

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