Strict dynamic mapping exception when importing visualizations and dashboards to kibana via curl


After a long and painful journey, I was able to write a script that changes the index id on imported visualizations/searchs/dashboard from kibana index into one of kibana's indeces that the user wants.
What I try to do is to send the files with the new id to kibana, using the saved_object api, like so:
curl -XPOST localhost:5601/api/saved_objects/search -H 'kbn-xsrf:true' -H 'Content-type:application/json' -d @./SOME_FILE.json

The problem:
It works only for imported searchs. For dashboards and visualizations, I get this error:
{"message":"mapping set to strict, dynamic introduction of [panelsJSON] within [search] is not allowed: [strict_dynamic_mapping_exception] mapping set to strict, dynamic introduction of [panelsJSON] within [search] is not allowed","statusCode":400,"error":"Bad Request"}
(BTW, I talked about a similar issue in this feed, but I open here another question because it wasn't answered there, and that post was quite lengthy and the basic topic was different, so I decided to open a dedicated one).

My questions are:

  1. Why dosen't it work for visualizations and dashboard but it does for searchs?
  2. How to work around/solve this issue?
    It's realy frustrating that I'm so close to have a simple script that imports everything from any kibana index and to be stuck on this...

Can anyone help?

BTW 2: If anyone will find it helpful to see how my script works, I would love to share. Just message me.


(Spencer Alger) #2

The data you are supplying must include a panelsJSON property, which is only valid for dashboards. Are you setting the proper type in the URL? localhost:5601/api/saved_objects/search would be for searches, localhost:5601/api/saved_objects/visualization for visualizations, and localhost:5601/api/saved_objects/dashboard for dashboards.


Thanks, I didn't notice my mistake. It works.

(system) #4

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