Skip to content

Instantly share code, notes, and snippets.

@lpenguin
Last active December 15, 2015 08:27
Show Gist options
  • Save lpenguin/c77e26663d44edffce0a to your computer and use it in GitHub Desktop.
Save lpenguin/c77e26663d44edffce0a to your computer and use it in GitHub Desktop.
bad search
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