Skip to content

Instantly share code, notes, and snippets.

@garron
Created August 26, 2013 21:31
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 garron/6346888 to your computer and use it in GitHub Desktop.
Save garron/6346888 to your computer and use it in GitHub Desktop.
Count and search status codes are inconsistent
#!/bin/bash
curl -XPOST "http://localhost:9200/myindex/mydoc/" -d '
{
"name": "my name"
}
'
echo '\n'
echo 'Count using a good query'
curl -s -o /dev/null -w "%{http_code}\n" -XGET "http://localhost:9200/myindex/mydoc/_count?q='name:name'"
echo 'Search using a good query'
curl -s -o /dev/null -w "%{http_code}\n" -XGET "http://localhost:9200/myindex/mydoc/_search?q='name:name'"
echo 'Count using a bad query'
curl -s -o /dev/null -w "%{http_code}\n" -XGET "http://localhost:9200/myindex/mydoc/_count?q='*name:name'"
echo 'Search using a bad query'
curl -s -o /dev/null -w "%{http_code}\n" -XGET "http://localhost:9200/myindex/mydoc/_search?q='*name:name'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment