Hey guys. If the "missing" option is provided in a string-sort, why does ES
generate an error instead of simply ignoring the option?
kimchy
(Shay Banon)
November 16, 2011, 2:21pm
2
missing is not supported for String values (currently), only for numeric
values. Can you gist the error you get?
On Wed, Nov 16, 2011 at 6:30 AM, Nick Hoffman nick@deadorange.com wrote:
Hey guys. If the "missing" option is provided in a string-sort, why does
ES generate an error instead of simply ignoring the option?
Sure thing, mate. Here it is:
query_output.txt
// Setup
{"ok":true,"acknowledged":true}
{"ok":true,"acknowledged":true}
{"ok":true,"_index":"test","_type":"tweets","_id":"1","_version":1}
{"ok":true,"_index":"test","_type":"tweets","_id":"2","_version":1}
{"ok":true,"_index":"test","_type":"tweets","_id":"3","_version":1}
// The first query, with the "missing" option, fails.
{
"error" : "SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[Z5lN30goQ0euwj3ce-OPrA][test][1]: SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [\n{ sort : [ { name : {order : \"asc\", missing: \"_last\"} } ] }\n]]]; nested: ElasticSearchIllegalArgumentException[Sorting on string type field does not support missing parameter]; }{[Z5lN30goQ0euwj3ce-OPrA][test][4]: SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [\n{ sort : [ { name : {order : \"asc\", missing: \"_last\"} } ] }\n]]]; nested: ElasticSearchIllegalArgumentException[Sorting on string type field does not support missing parameter]; }{[Z5lN30goQ0euwj3ce-OPrA][test][2]: SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [\n{ sort : [ { name : {order : \"asc\", missing: \"_last\"} } ] }\n]]]; nested: ElasticSearchIllegalArgumentException[Sorting on string type field does not support missing parameter]; }]",
This file has been truncated. show original
test.sh
curl -X DELETE 'localhost:9200/test'
curl -X PUT 'localhost:9200/test'
curl -X POST 'localhost:9200/test/tweets/1' -d '{ name : "Grimlock" }'
curl -X POST 'localhost:9200/test/tweets/2' -d '{ }'
curl -X POST 'localhost:9200/test/tweets/3' -d '{ name : "Goldbug" }'
sleep 1
curl 'localhost:9200/test/tweets/_search?pretty=true' -d '
{ sort : [ { name : {order : "asc", missing: "_last"} } ] }
This file has been truncated. show original
On Wednesday, 16 November 2011 09:21:14 UTC-5, kimchy wrote:
missing is not supported for String values (currently), only for numeric
values. Can you gist the error you get?
So if I want the documents with a null value for the sort-field to be at
the end of the results, must that be done after retrieving the results from
ES?