nested: SearchParseException[[index_name][2]: from[-1],size[-1]: Parse Failure [No mapping found for [name] in order to sort on]]; }]
在使用 sort ,若是沒有該 type 的 mapping ,預設的情況下會 return fail 。 這時候可以使用 ignore_unmapped 在 忽略 sort 該欄位時沒有存在 mapping的情況。
{ "sort" : [ { "price" : {"ignore_unmapped" : true} }, ], "query" : { "term" : { "user" : "kimchy" } } }
sorting - No mapping found for field in order to sort on in ElasticSearch - Stack Overflow
http://stackoverflow.com/questions/17051709/no-mapping-found-for-field-in-order-to-sort-on-in-elasticsearch
Sort ignoring_unmapped_fields http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html#_ignoring_unmapped_fields
沒有留言:
張貼留言