I have a document model like this:
"customer": { "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "orders": { "type": "nested", "properties": { "id": { "type": "integer" }, "orderDate" : { "type": "date", "format" : "YYYY-MM-dd" }, "orderLines": { "type": "nested", "properties": { "seqno": { "type": "integer" }, "quantity": { "type": "integer" }, "articleId": { "type": "integer" } } } } } } }
A customer can have 0, 1 or more orders, and an order can have 0, 1 or more orderLines
(this is the model I created for this question, since I think it is data that everyone can understand, so if you notice any errors, let me know, but do not let them distract you from my actual question)
I want to create a query using NEST that selects (or all) clients with a specific value for customer.id, but only if they have at least one orderLine with a specific articleId.
I looked. I need specific documentation / examples of building a complex index using the NEST ElasticSearch library and Full compliance of a nested collection element instead of individual elements using Elastic Search , but could not create a query. Based on the second question, I went so far as to write
var results = client.Search<customer>(s => s .From(0) .Size(10) .Types(typeof(customer)) .Query(q => q.Term(c => c.id, 12345) && q.Nested(n => n .Path(c => c.order) .Query(q2 => q2.Nested(n2 => n2 .Path(o => o.???)))) ) );
I expected the second Path to use order (List orders) as a generic type, but it is a client.
What is the code for the correct request?
In addition: is there a more detailed documentation of NEST search / query / filtering methods than the documentation at http://nest.azurewebsites.net/ ? In the first question asked, both links to a complex query textbook (in the question) and unit test examples (accepted answer) do not work (timeout and 404, respectively).