Skip to content

Instantly share code, notes, and snippets.

@lmader
Created August 7, 2012 23:22
Show Gist options
  • Save lmader/3290485 to your computer and use it in GitHub Desktop.
Save lmader/3290485 to your computer and use it in GitHub Desktop.
shardFailures in SearchResponse showing from previous query
Steps to repro issue with the shardFailures array showing msgs from a previous (not current) query:
1) create something
curl -XPUT localhost:9200/acme/blog/1111 -d '{"message":"foo"}'
2) execute this query, it should succeed
curl -XGET localhost:9200/acme/blog/_search -d '{"query":{"field":{"message":"foo"}}}'
3) this is an invalid query and is expected to fail
curl -XGET localhost:9200/acme/blog/_search -d '{"foobar":{"message":"foo"}}'
4) now rerun the query from step 2. This query succeeds, and returns the hits, but also shows the shardFailures from the failed query in step 3
curl -XGET localhost:9200/acme/blog/_search -d '{"query":{"field":{"message":"foo"}}}'
Here is the expected output from step 4) :
{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0,"failures":[{"index":"acme","shard":1,"status":400,"reason":"SearchParseException[[acme][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"foobar\":{\"message\":\"foo\"}}]]]; nested: SearchParseException[[acme][1]: from[-1],size[-1]: Parse Failure [No parser for element [foobar]]]; "},{"index":"acme","shard":0,"status":400,"reason":"SearchParseException[[acme][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"foobar\":{\"message\":\"foo\"}}]]]; nested: SearchParseException[[acme][0]: from[-1],size[-1]: Parse Failure [No parser for element [foobar]]]; "},{"index":"acme","shard":4,"status":400,"reason":"SearchParseException[[acme][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"foobar\":{\"message\":\"foo\"}}]]]; nested: SearchParseException[[acme][4]: from[-1],size[-1]: Parse Failure [No parser for element [foobar]]]; "}]},"hits":{"total":1,"max_score":1.6931472,"hits":[{"_index":"acme","_type":"blog","_id":"1111","_score":1.6931472, "_source" : {"message" : "foo" }}]}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment