Can get document by ID but not find it in query all?

Hey Alex,

Thanks for your reply and taking the time to give it a try.

Those curl statements that I wrote were run several minutes apart (or
longer), as I had to poke around through the Elasticsearch API to figure
them out. They didn't run back-to-back-to-back like my presentation
suggested. So assuming the default refresh time is 1 minute, it shouldn't
have been a factor.

Any other thoughts?

-- Jeremy

On Tuesday, 25 June 2013 23:42:19 UTC-7, Alexander Reelsen wrote:

Hey,

I've extracted the curl calls from your last mail and addred a
'refresh=true' to the index call (in order to make the indexed document
available for search immediately instead of the possibility of having to
wait for one second), and it seems to work now

curl -X DELETE localhost:9200/test/_stats
curl -X PUT localhost:9200/test/_stats
curl -XPUT 'localhost:9200/test/log/test1?refresh=true' -d
'{"eventType":"ADD_USER","eventTime":"1363219822000","_id":"test1"}'
curl 'localhost:9200/test/_stats?pretty=true'
curl localhost:9200/test/log/test1
curl -XGET 'localhost:9200/test/log/_search?q=_id:test1' -d
'{"query":{"match_all":{}}}'
curl 'localhost:9200/test/_search?q=:&size=10'
curl -XGET localhost:9200/test/log/_search -d '{"query":{"match_all":{}}}'

Long story short: A document can be retrieved with GET on its ID
immediately after it has been put into elasticsearch. However the
possibility of searching a document may last up to one second after
indexation, because this 'view' has to be refreshed in order to make sure
fresh indexed data can be searched. This happens automatically every second
in the background and can be enforced by adding 'refresh=true' to the index
operation (dont do this in a live system, it is a costly operation and
should not be done with every index operation).

Hope this helps.

--Alex

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.