Elastic search data pull endpoint data availibility issue

Hello everyone,

I have deployed elastic search on a ubuntu machine, I am making curl calls to push and pull the data back using these calls,

LOGS

Request

curl -X POST "localhost:9200/twitter1/_doc/1" -H 'Content-Type: application/json' -d'
{
"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elasticsearch"
}
' && curl -X GET "localhost:9200/twitter1/_search" -H 'Content-Type: application/json'

Response

{"_index":"twitter1","_type":"_doc","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":1}

{"took":53,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":0,"max_score":null,"hits":}}

As you can see above the although the data has been inserted in the document in first curl call and when I try to pull the data back in the first request I didn't get data but in the second call I get data.

Question

  • Isn't the POST call a blocking call?
  • Why the data is not immediately available?

As explained in this blog post documents are made searchable periodically. You may therefore need to wait up to the refresh interval (default 1 second) to be able to search for the new data.

@Christian_Dahlqvist Thank you the response

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.