Elastic api is not working in elk6

Hi Team,

I am unable to create search by using elastic API,
the same thing is wokring on ELK5 but not working in ELK6.
Please help.

Please find the below command & error:

curl -H 'Authorization:Basic XXXXXXXXXX' -H 'Content-Type: application/json' --cacer XXXX.pem -s -XPOST https://XXXXXXXXXX:9200/.kibana/search/XXXXXXXXXXXX -d '{"title" : "xxxxxxxxxxxxxxxxx","description" : "XXXXXXXX","hits" : 0,"columns" : [ "_source" ],"sort" : [ "_score", "desc" ],"version" : 1,"kibanaSavedObjectMeta" : {"searchSourceJSON" : "{"index":"*********","query":{"query_string":{"query":"\"XXXXXXXXXXX\" AND \"XXXXXXXXXX\"","analyze_wildcard":true}},"filter":[],"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fields":{"":{}},"require_field_match":false,"fragment_size":2147483647}}"} } '

Error:
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [.kibana_1] as the final mapping would have more than 1 type: [search, doc]"}],"type":"illegal_argument_exception","reason":"Rejecting mapping update to [.kibana_1] as the final mapping would have more than 1 type: [search, doc]"},"status":400}

Just to understand what you are doing here, are you uploading a new saved search?

Thanks Mark for quick response,

Yes, I was trying to upload the json of search.
but the same format which I had used it for ELK5 was working.

Ok, that format is not correct.

You might want to look at the format of a saved search in the newer version and reformat your document.

I just downloaded the same search from ELK5 and ELK6, both are same.
I have tested by downloading from ELK5 and uploading directly using import into ELK6, it's working fine.
I am facing issue only when I use curl an upload in ELK6.

Please advise on the error:
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [.kibana_1] as the final mapping would have more than 1 type: [search, doc]"}],"type":"illegal_argument_exception","reason":"Rejecting mapping update to [.kibana_1] as the final mapping would have more than 1 type: [search, doc]"},"status":400}

I have used kibana saved objects API for creating dashboards and its working.

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