Confused about why scroll api doesn't seem to function

(Tim Ford) #1
curl 'http://localhost:9200/<index>/<type>/_search?scroll=1m'  -H 'content-type: application/json;charset=UTF-8' -H 'accept: application/json' --data-binary '{"query":{"match_all":{}},"sort":["_doc"],"size":100}' --compressed



I have done some other things as well where the query is more complicated, but decided to take it to the simplest form available in the documentation. I was expecting to get back a "scroll_id"

current version of elastic search

  "version" : {
    "number" : "2.3.4",
    "build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f",
    "build_timestamp" : "2016-06-30T11:24:31Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"

(Nik Everett) #2

That output you posted is the response you get when creating a document.

Also it is nice to wrap code in ``` so it is highlighted and stuff. It is also useful to add &pretty to most uses of curl so it is easier to read the responses.

(Tim Ford) #3

Any idea why its giving the document create response?

(Nik Everett) #4

I'm not sure! Something to do with the way you are invoking curl. Can you
remove some of the options and try again? Usually I just use -X and -d.

(Tim Ford) #5

yeah no change

(Nik Everett) #6

I tried this and it worked as expected:

curl -XPOST localhost:9200/test/test?refresh -d'{"test":"test"}'
curl 'http://localhost:9200/test/test/_search?scroll=1m'  -H 'content-type: application/json;charset=UTF-8' -H 'accept: application/json' --data-binary '{"query":{"match_all":{}},"sort":["_doc"],"size":100}' --compressed

Here is my curl version:

$ curl --version
curl 7.38.0 (x86_64-pc-linux-gnu) libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API SPNEGO NTLM NTLM_WB SSL libz TLS-SRP 

I'm not sure if there is anything else I can do for you though.

(Tim Ford) #7

I found the issue --- was too confident in one of the components I was using in my system -- it was working just fine for normal queries -- when trying to use it for the scroll api it's failing for some reason i.e _search vs _search?scroll=1m -- very weird

(system) #8