IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
More Like This Full Document Query Usage
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
More Like This Full Document Query Usage
editFluent DSL example
editq
.MoreLikeThis(sn => sn
.Fields(ff => ff
.Field(f => f.Name)
.Field(f => f.Description)
)
.Like(l => l
.Document(d => d
.Document(Project.Instance)
.Routing(Project.Instance.Name)
)
.Text("some long text")
)
)
Object Initializer syntax example
editnew MoreLikeThisQuery
{
Fields = Infer.Fields<Project>(
f => f.Name,
f => f.Description),
Like = new List<Like>
{
new LikeDocument<Project>(Project.Instance) { Routing = Project.Instance.Name },
"some long text"
}
}
Example json output.
{
"more_like_this": {
"fields": [
"name",
"description"
],
"like": [
{
"_index": "project",
"doc": {
"name": "Koch, Collier and Mohr",
"state": "BellyUp",
"startedOn": "2015-01-01T00:00:00",
"lastActivity": "0001-01-01T00:00:00",
"leadDeveloper": {
"gender": "Male",
"id": 0,
"firstName": "Martijn",
"lastName": "Laarman"
},
"location": {
"lat": 42.1523,
"lon": -80.321
}
},
"routing": "Durgan LLC"
},
"some long text"
]
}
}