Open chrillewoodz opened 7 years ago
I tried removing the return altogether and then a stringed query works as expected. I am unsure as to if this will cause other things to break however.
If you look at the _buildQuery method, you'll see that the only way you can get a null returned there is one of the following:
1) You did not include type
or index
code
2) You did not include query
(deprecated/legacy), body
(object|string) or q
(string) code
3) The body
attribute was a string but did not contain valid JSON code
If you've verified that it's returning null when the body
is a string, then it means it's not a valid JSON string, and there would be a warning in the logs.
It does seem like, rather than returning null in the _process method, we could return an error to the client. That part looks incorrect, but the end result is accurate--the body isn't valid JSON.
I've done some digging in the source and found this:
When you've stringified the body so it looks like this:
body: "{"query":{"bool":{"must":[{"nested":{"path":"guestlist","query":{"bool":{"must":[{"path":"list","query":{"bool":{"must":[{"match_phrase_prefix":{"list.name":"c"}}]}}}]}}}}]}}}"
This snippet below just returns
null
, causing the actual search function not to run at all sincequery
isnull
here:It seems to me like the first snippet shouldn't return null, but rather something else. Such as
queryData.body
, however I tried to change it to this but then I got an error for my query. I am not sure if it's down to it being an invalid query but here it is:And the error it spits out is:
I hope you can investigate this.