-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
NEST/Elasticsearch.Net version:
version 7.15
Elasticsearch version:
7.15
.NET runtime version:
Operating system version:
Description of the problem including expected versus actual behavior:
The second clause of a query is dropped.
Steps to reproduce:
code snippet:
var translateRequest = new TranslateSqlRequest();
translateRequest.Query = “select * from A where X = 1 and Y like ‘%B%’”;
var translateResponse = client.Sql.Translate(translateRequest);
var elasticQuery = translateResponse.Result;
var result = client.Search<K>(elasticQuery);
So basically translate sql query ( highlevel client ) and then take translated query from response and try to actually run the search. (I know there is a workaround but that is a different issue unfortunately.)
Now what happens is that translation goes well and I can see proper translated query ( below )
Result:
"query" : {
"bool" : {
"must" : [
{ "term" : { "X" : { "value" : "1", "boost" : 1.0 } } },
{ "wildcard" : { "B.keyword" : { "wildcard" : "*B*", "boost" : 1.0 } } }
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
But for some reason why I pass it to search the second condition is vanishing from query.
It returns results like the query was “select * from A where X = 1” which it is not.
I enabled debug mode and I can see that indeed executed query is:
{"from":0,"query":{"bool":{"must":[{"term":{"A":{"value":1,"boost":1.0}}}],"boost":1.0}},"size":100,"sort":[{"B.keyword":{"unmapped_type":"keyword","missing":"_last","order":"asc"}}],"_source":true}
AS you can see whole { "wildcard" : { "B.keyword" : { "wildcard" : "*B*", "boost" : 1.0 } } }
is missing from it.
It appears range query as second condition does not work as well.
Expected behavior
A clear and concise description of what you expected to happen.
Provide ConnectionSettings
(if relevant):
Provide DebugInformation
(if relevant):