Description
Elastic.Clients.Elasticsearch version:
8.9.3 - (downgraded from latest 8.14.6 as the documentation does not comply with it)
Elasticsearch version:
8.14.2
.NET runtime version:
net7.0
Operating system version:
window 11
Description of the problem including expected versus actual behavior:
I wanted to post this as a question in the discussion board but I got "An error occurred: Sorry you cannot post a link to that host".
Therefore I'm writing this here.
I'm using the latest elasticsearch-net client, I could not find documentation or hints related to using nested queries or mapping but the deprecated ones (NEST).
What I tried:
searchResponse = await elasticsearchClient.SearchAsync<ElasticSearchTestDocument>(s => s
.Index(indexName)
.From(0)
.Size(10)
.Query(q =>
{
q.Nested(n =>
{
n.Path(p => p.Items.First())
.Query(nq =>
{
nq.Bool(b =>
{
b.Must(m =>
{
m.Match(mt =>
{
mt.Field(f => f.Items.First().ItemId)
.Query(item2Id.ToString());
});
});
});
});
});
})
);
this will throw an error "failed to find nested object under path"
added the ignore
flag under Nested
:
q.Nested(n =>
{
n.IgnoreUnmapped();
Query had no error but no documents.
I understand the Nested
attribute was there in NEST
but could not find it in the mentioned version.
public class ElasticSearchTestDocument
{
public string Title { get; set; }
[Nested]
public List<ElasticSearchTestItemDocument> Items { get; set; }
}
Is it experimental that there is only very simple/little CRUD documentation on the new API or am I missing something?
Any take on this would be appreciated.