Response after create new index

When i create new index the response contains like this

{
  "acknowledged": true,
  "shards_acknowledged": true,
  "index": "my-index"
}

My question is about of tihis response keywords, what do these three keywords mean, respectively? For example, what should I understand from the response shards_acknowledged: true?

Hi there @Scorp, our documentation has the following explanation:

acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. Note that it is still possible for either acknowledged or shards_acknowledged to be false , but the index creation was successful. These values simply indicate whether the operation completed before the timeout. If acknowledged is false , then we timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. If shards_acknowledged is false , then we timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (i.e. acknowledged=true ).

2 Likes

I understand perfectly. But after i read your anwser new question appeared my mind. Why we do have to have a time to create index and its shards? Why we do not wait for index to be created?

If you refer to the documentation I linked previously, you'll see that you can use wait_for_active_shards.

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