elasticsearch-net
elasticsearch-net copied to clipboard
Incorrect query in example documentation
Elastic.Clients.Elasticsearch version:
Elasticsearch version: 8.x
.NET runtime version: 8
Operating system version:
Description of the problem including expected versus actual behavior: The provided example for a term query does not work for the new version. Have not tested the other examples so more examples have to be updated.
Steps to reproduce: Go to https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/examples.html#searching-net Example:
var response = await client.SearchAsync<Tweet>(s => s
.Index("my-tweet-index")
.From(0)
.Size(10)
.Query(q => q
.Term(t => t.User, "stevejgordon")
)
);
if (response.IsValidResponse)
{
var tweet = response.Documents.FirstOrDefault();
}
Expected behavior
The example should be:
var response = await client.SearchAsync<Tweet>(s => s
.Index("my-tweet-index")
.From(0)
.Size(10)
.Query(q => q
.Term(t => t.Field(f => f.User).Value("stevejgordon"))
)
);
if (response.IsValidResponse)
{
var tweet = response.Documents.FirstOrDefault();
}