Rejecting mapping update to [] as the final mapping would have more than 1 type: [_doc, doc]

I have my own mapping that I dump to my running localhost:9200/abc.

In my elasticsearch.yml I have action.auto_create_index: false

I have a docker-compose that spins up elasticsearch, kibana and logstash.

Logstash input is logstash-input-jdbc. The output is to index abc, on 9200 elasticsearch.

Everything works. Kind of. I know I need to adjust when Logstash spins up. But, logstash seems to be creating a mapping index with the document type of "doc". My mapping has the type of "_doc".

Can someone explain why logstash and elasticsearch are fighting efforts. I'm telling logstash that I have the index, use mine. Without the action.auto_create_index: false in elasticsearch.yml, logstash will create the index with the doc type of "doc". Wouldn't it make sense that if I tell it "no, don't create my index", that it won't - and it wouldn't have a conflict of types?!?!

logstash_1 | [2018-06-14T18:45:05,129][WARN ][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"abc", :_type=>"doc", :_routing=>nil}, #LogStash::Event:asfdasfdasfd], :response=>{"index"=>{"_index"=>"abc", "_type"=>"doc", "_id"=>"dasdfasdfasfd", "status"=>400, "error"=>{"type"=>"illegal_argument_exception", "reason"=>"Rejecting mapping update to [abc] as the final mapping would have more than 1 type: [_doc, doc]"}}}}

To be clear, I know I can't have multiple types. I'm not trying to have multiple types. I can't figure out where the "doc" type is coming from.

Apparently action.auto_create_index only prevents Kibana from creating an index in localhost:5600?!? I see that it also prevents ES from creating an index within ES as well, but now I can't discover index patterns with action.auto_create_index set to false?! And, while ES doesn't create a "doc" type index, when I curl for it, I still have the same error message in my OP. I changed my mappings that I create on ES to "doc" and I can logstash-input-jdbc now without said error. But, it's wrong. It should be "_doc" according to your documentation and other posts. And, I can't see my data in Kibana to see why my curl of a search fails (brings back data but way too much data - Logstash inputs on a schedule, each minute. It's duplicating data but I can't verify that in Kibana).

1 Like

The answer is setting document_type => "_doc" in the output in logstash.conf

14 Likes

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