Index creation on bulk update

Hello.
I noticed for operation bulk update, for example
POST http://localhost:9200/_bulk

{"update":{"_id":"1", "_index" : "index", "_type": "type"}}
{"doc": {"id": "1", "name": "test"}}

if index with name "index" doesn't exist I will recieve response

   {
        "took": 115,
        "errors": true,
        "items": [
            {
                "update": {
                "_index": "index",
                "_type": "type",
                "_id": "1",
                "status": 404,
                "error": {
                    "type": "document_missing_exception",
                    "reason": "[type][1]: document missing",
                    "index_uuid": "e7URDCeDRJGCclNISsFr2Q",
                    "shard": "3",
                    "index": "index"
                    }
                }
            }
        ]
    }

and index with name "index" will be created. As I see error absolutely correct, because I don't have any docs, but creating new index is strange for me. I waited for error like "No such index"
Can someone, please, explain such behavior. Is it correct that new index was created? And how can I avoid it without extra check for index existance?

That sounds "correct" to me.
I mean that the way elasticsearch works will first create any missing index before executing any request on that index.
I'm not surprised and I'm not sure if this should be considered as a bug.

Thank you for your time. I will remeber it. It would be good to take note about it in documentation.

As a solution that affects the whole system, adding action.auto_create_index: false in elasticsearch.yml will solve this task.

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