Elasticsearch query to return all records
I think lucene syntax is supported so:
http://localhost:9200/foo/_search?pretty=true&q=*:*
size defaults to 10, so you may also need &size=BIGNUMBER
to get more than 10 items. (where BIGNUMBER equals a number you believe is bigger than your dataset)
BUT, elasticsearch documentation suggests for large result sets, using the scan search type.
EG:
curl -XGET 'localhost:9200/foo/_search?search_type=scan&scroll=10m&size=50' -d '{ "query" : { "match_all" : {} }}'
and then keep requesting as per the documentation link above suggests.
EDIT: scan
Deprecated in 2.1.0.
scan
does not provide any benefits over a regular scroll
request sorted by _doc
. link to elastic docs (spotted by @christophe-roussy)
http://127.0.0.1:9200/foo/_search/?size=1000&pretty=1 ^
Note the size param, which increases the hits displayed from the default (10) to 1000 per shard.
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-from-size.html
elasticsearch(ES) supports both a GET or a POST request for getting the data from the ES cluster index.
When we do a GET:
http://localhost:9200/[your index name]/_search?size=[no of records you want]&q=*:*
When we do a POST:
http://localhost:9200/[your_index_name]/_search{ "size": [your value] //default 10 "from": [your start index] //default 0 "query": { "match_all": {} }}
I would suggest to use a UI plugin with elasticsearch http://mobz.github.io/elasticsearch-head/This will help you get a better feeling of the indices you create and also test your indices.