Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect query in example documentation #8118

Open
borsna opened this issue Apr 12, 2024 · 0 comments
Open

Incorrect query in example documentation #8118

borsna opened this issue Apr 12, 2024 · 0 comments
Labels
8.x Relates to 8.x client version Area: Documentation Category: Bug

Comments

@borsna
Copy link

borsna commented Apr 12, 2024

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(); 
}
@borsna borsna added 8.x Relates to 8.x client version Category: Bug labels Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to 8.x client version Area: Documentation Category: Bug
Projects
None yet
Development

No branches or pull requests

2 participants