Skip to content

Instantly share code, notes, and snippets.

@rplevy
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rplevy/54ba1146160be418e67d to your computer and use it in GitHub Desktop.
Save rplevy/54ba1146160be418e67d to your computer and use it in GitHub Desktop.
failing _validation, but _search works
curl -s -XGET 'http://localhost:9200/4af9aae4-7ec1-458d-8c50-692ddb0f2c6d/msg,file,file-info/_validate/query?explain=true' -d '{"fields":["id"],"filter":{"not":{"and":[{"numeric_range":{"msg-size":{"gte":1000}}},{"query":{"prefix":{"content-type.verbatim":"application/"}}}]}}}' | python -mjson.tool
{
"_shards": {
"failed": 0,
"successful": 1,
"total": 1
},
"explanations": [
{
"error": "org.elasticsearch.index.query.QueryParsingException: [4af9aae4-7ec1-458d-8c50-692ddb0f2c6d-0] request does not support [fields]",
"index": "4af9aae4-7ec1-458d-8c50-692ddb0f2c6d-0",
"valid": false
}
],
"valid": false
}
# removing fields, it reports that query does not support filter
curl -s -XGET 'http://localhost:9200/4af9aae4-7ec1-458d-8c50-692ddb0f2c6d/msg,file,file-info/_validate/query?explain=true' -d '{"filter":{"not":{"and":[{"numeric_range":{"msg-size":{"gte":1000}}},{"query":{"prefix":{"content-type.verbatim":"application/"}}}]}}}' | python -mjson.tool
{
"_shards": {
"failed": 0,
"successful": 1,
"total": 1
},
"explanations": [
{
"error": "org.elasticsearch.index.query.QueryParsingException: [4af9aae4-7ec1-458d-8c50-692ddb0f2c6d-0] request does not support [filter]",
"index": "4af9aae4-7ec1-458d-8c50-692ddb0f2c6d-0",
"valid": false
}
],
"valid": false
}
# some queries work with validate API
curl -s -XGET 'http://localhost:9200/4af9aae4-7ec1-458d-8c50-692ddb0f2c6d/msg,file,file-info/_validate/query?explain=true' -d '{"query": { "match": { "name": "PLEASE READ: something not important" }}}' | python -mjson.tool
{
"_shards": {
"failed": 0,
"successful": 1,
"total": 1
},
"explanations": [
{
"explanation": "filtered(name:PLEASE READ: something not important)->cache(_type:file _type:file-info _type:msg)",
"index": "4af9aae4-7ec1-458d-8c50-692ddb0f2c6d-0",
"valid": true
}
],
"valid": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment