-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
NEST/Elasticsearch.Net version: 6.0.0-beta1
Elasticsearch version: 6.1.1
Problem:
When building a search descriptor including a HasParent descriptor, the final search query does not parse properly.
Steps to reproduce:
- Create parent/child documents with a base class and a JoinField.
- Index parent and child
- Create a SearchDescriptor including HasParent descriptor.
- Run search, failes with invalid result, see Debug Information.
- Take the generated query from the debug information, replace "type": "sampleparent" with "parent_type" : "sampleparent". Run the query in a native REST client. The query is valid and gives the expected result.
Sample snippet:
var searchDescriptor = new SearchDescriptor<SampleChild>()
.Query(q => q.HasParent<SampleParent>(p => p.Query(qx => qx.Term(t => t.Id, sampleParent.Id))))
.Index("sample").Type("samplebase");
var searchResult = client.Search<SampleChild>(searchDescriptor);
See sample source:
HasParentProgramm.txt
Provide DebugInformation (if relevant):
Invalid NEST response built from a unsuccessful low level call on POST: /sample/samplebase/_search?typed_keys=true
# Audit trail of this API call:
- [1] BadResponse: Node: http://localhost:9200/ Took: 00:00:00.1491518
# OriginalException: System.Net.WebException: The remote server returned an error: (400) Bad Request.
at System.Net.HttpWebRequest.GetResponse()
at Elasticsearch.Net.HttpConnection.Request[TResponse](RequestData requestData) in T:\TeamCity\buildAgent\work\38a00213fd0f22c3\src\Elasticsearch.Net\Connection\HttpConnection.cs:line 167
# Request:
{"query":{"has_parent":{"type":"sampleparent","query":{"term":{"id":{"value":"703ca000d47e4da7839fce7e3174fd18"}}}}}}
# Response:
{"error":{"root_cause":[{"type":"parsing_exception","reason":"[has_parent] query does not support [type]","line":1,"col":32}],"type":"parsing_exception","reason":"[has_parent] query does not support [type]","line":1,"col":32},"status":400}
Metadata
Metadata
Assignees
Labels
No labels