Kibana Bulk Create API Fails To Overwrite on 7.10 returning 409

I have been using various scripts to create dashboards and visualizations from a template successfully on 7.5. When I try the same script on 7.10 it fails, and every visualization returns a 409 conflict error.

I'm posting this to Kibana: /api/saved_objects/_bulk_create?overwrite=true and including a json file with my dashboard and linked visualizations. With 7.10 I get something like this on each visualization:


"saved_objects": [
            {
                "error": {
                    "error": "Conflict", 
                    "message": "Saved object [dashboard/Summary-data] conflict", 
                    "statusCode": 409
                }, 
                "id": "Summary-data", 
                "type": "dashboard"
            }, 

From reading the documentation it says I can use the Resolve Import Errors to resolve each conflict one by one. This seems tedious because I always want to overwrite, and secondly I do not think these are real conflicts, as far as I can tell the objects do not exist.

Hm, I can't think of any changes between 7.5 and 7.10 that would have this effect on the Bulk create API. If you are using the overwrite option, it should happily overwrite any existing objects for you.

Can you provide your full payload and the full response that you receive?

Also, I understand you said this object doesn't exist, but can you try the following and see what you get back?

GET /api/saved_objects/dashboard/Summary-data

The Resolve import errors API should only be used to resolve errors that are received when using the Import objects API. That said, you would probably be better off exporting your dashboard and visualizations, and using the Import API in the future so that you can take advantage of any saved object migrations that occur between Kibana versions. If you are directly using the Bulk create API like that without specifying a migrationVersion for each saved object, Kibana assumes that you are creating a brand new object, and that all of the fields are up to date with the current version of Kibana.

Also keep in mind that all Saved Objects APIs are marked as experimental at the moment.

It would also be useful to see verbose logging and the elasticsearch queries just before and after your request. Can you add the following to your configuration:

logging.verbose: true
elasticsearch.logQueries: true

Thanks, after switching to "/api/saved_objects/_bulk_create?overwrite=true" I can re-create my dashboards and visualizations.

I think the change in behaviour you saw might have been caused by https://github.com/elastic/kibana/pull/75172

Before create and bulk_create would have ignored the version field so you wouldn't get a conflict if a file with a newer version already exists.

Either way, overwrite=true seems to be what you're after.

Thanks Rudolph, my json file template definitely has version and migration version on probably every object. I was setting overwrite to true and it would fail as well. Since changing the API I was using I have not re-visited this.