More Like This Full Document Query Usage

edit

Fluent DSL example

edit
q
.MoreLikeThis(sn => sn
    .Like(l => l
        .Document(d => d
            .Document(Project.Instance)
            .Routing(Project.Instance.Name)
        )
        .Text("some long text")
    )
)

Object Initializer syntax example

edit
new MoreLikeThisQuery
{
    Like = new List<Like>
    {
        new LikeDocument<Project>(Project.Instance) { Routing = Project.Instance.Name },
        "some long text"
    }
}

Example json output.

{
  "more_like_this": {
    "like": [
      {
        "_index": "project",
        "_type": "doc",
        "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"
    ]
  }
}