This repository was archived by the owner on Nov 7, 2018. It is now read-only.
This repository was archived by the owner on Nov 7, 2018. It is now read-only.
sort criteria on invalid field should report well-formed json error #220
Open
Description
We've seen this a few times in production. It's not clear how I can reproduce it and it may be the result of someone playing with the API, but we should not generate internal errors as a result of bad user input.
Elasticsearch::Transport::Transport::Errors::BadRequest: [400]
{"error":"SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed; shardFailures {[7WAeJDHBSg-crOH2AwOEMg][production-school-data][0]: SearchParseException[[production-school-data][0]: query[ConstantScore(*:*)],from[0],size[20]: Parse Failure [Failed to parse source [{\"from\":0,\"size\":20,\"query\":{\"match_all\":{}},\"_source\":{\"exclude\":[\"_*\"]},\"sort\":[{\"advantage\":{\"order\":\"desc\"}}]}]]]; nested:
SearchParseException[[production-school-data][0]: query[ConstantScore(*:*)],from[0],size[20]: Parse Failure [No mapping found for [advantage] in order to sort on]]; }]","status":400}
…t-1.0.12/lib/elasticsearch/transport/transport/base.rb: 135:in `__raise_transport_error'
…t-1.0.12/lib/elasticsearch/transport/transport/base.rb: 227:in `perform_request'
…/lib/elasticsearch/transport/transport/http/faraday.rb: 20:in `perform_request'
…transport-1.0.12/lib/elasticsearch/transport/client.rb: 119:in `perform_request'
…rch-api-1.0.12/lib/elasticsearch/api/actions/search.rb: 159:in `search'
/home/vcap/app/lib/data_magic.rb: 82:in `search'