MLT Query Not Showing in Serialized JSON Output

I am trying to create an Elasticsearch MLT query using NEST's object initializer syntax. However, the final query when serialized, is ONLY missing the MLT part of it. Every other query is present though.

When inspecting the query object, the MLT is present. It's just not getting serialized.

I wonder what I may be doing wrong.

I also noticed that when I add Fields it works. But I don't believe fields is a mandatory property here that when it is not set, then the MLT query is ignored.

The MLT query is initialized like this;
....

    new MoreLikeThisQuery
        {
            Like = new[]
            {
                new Like(new MLTDocProvider
                {
                    Id = parameters.Id
                }), 
            }
        }

MLTDocProvider implements the ILikeDocument interface.

I expect the serialized query to contain the MLT part, but it is the only part that is missing.

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