More Like This

edit

The more like this (mlt) API allows to get documents that are "like" a specified document.

Fluent DSL

edit
var result = client.MoreLikeThis<ElasticsearchProject>(mlt => mlt
    .Id(1)
    .MltFields(p => p.Country, p => p.Content)
    .MinDocFreq(1)
    .Search(s => s
        .From(0)
        .Size(20)
    )
);

Object Initializer Syntax

edit
var request = new MoreLikeThisRequest<ElasticsearchProject>(1)
{
    MltFields = new PropertyPathMarker[] { "country", "content"},
    MinDocFreq = 1,
    Search = new SearchRequest
    {
        From = 0,
        Size = 10
    }
};

var result = client.MoreLikeThis<ElasticsearchProject>(request);

Handling the MLT response

edit

.MoreLikeThis<T> behaves just like .Search<T> in that it also returns an ISearchResponse<T>.

See the {ref_current}/search-more-like-this.html[original docs] for more information.