Last active
December 15, 2015 08:27
-
-
Save lpenguin/c77e26663d44edffce0a to your computer and use it in GitHub Desktop.
bad search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from elasticsearch import Elasticsearch, TransportError | |
import json | |
client = Elasticsearch() | |
try: | |
client.search(body={'foo': 'bar'}) | |
except TransportError as ex: | |
print(ex.error) | |
print(json.dumps(ex.info, indent=2)) | |
""" | |
search_phase_execution_exception | |
{ | |
"error": { | |
"type": "search_phase_execution_exception", | |
"root_cause": [ | |
{ | |
"line": 1, | |
"type": "search_parse_exception", | |
"col": 2, | |
"reason": "failed to parse search source. unknown search element [foo]" | |
} | |
], | |
"reason": "all shards failed", | |
"grouped": true, | |
"failed_shards": [ | |
{ | |
"index": ".kibana", | |
"shard": 0, | |
"node": "63sIQImaQe-7sPNoMqLORw", | |
"reason": { | |
"line": 1, | |
"type": "search_parse_exception", | |
"col": 2, | |
"reason": "failed to parse search source. unknown search element [foo]" | |
} | |
} | |
], | |
"phase": "query" | |
}, | |
"status": 400 | |
} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment