I tried to dynamically create an index (if not exist) with static mapping, then added a document to it immediately. After that, I checked mapping of the index and found that the mapping is not what I described in request. It seems that mapping is dynamically created according to the fields of the document.
But if the document is added in seconds after index created, everything works as expected.
My question is:
- Is the API of creating index asynchronous and I should wait util index created before adding document?
- If not, what is the correct way to achieve "create an index if not exist and add a document to it"?