I am using the latest (6.0) ElasticStack for clear setup (no migrations)
I have the following type mapping:
PUT my_index { "mappings": { "my_type": { "dynamic": "strict", "properties": { "CampaignId": { "type": "integer"}, "DepartmentId": { "type": "integer"}, "CompanyId": { "type": "integer"}, "Budget": { "type": "double"}, "StartDate": { "type": "date"}, "EndDate": { "type": "date"} } } } }
Adding a new document works fine and creates a document with the _type=my_type
POST my_index/my_type { "CampaignId" : 12, "DepartmentId" : 10, "CompanyId": 100, "Budget": 123.123 }
But when I use the Logstash it creates documents with _type=doc and fail to add them into the index with this error:.
Rejecting mapping update to [my_index] as the final mapping would have more than 1 type: [my_type, doc]
I can fix it by adding the document_type => "my_type", but it's obsolete in version 6, so suspect it should work without it or there is another way to specify the _type.
Logstash conf:
input { jdbc { ... } } filter { } output { elasticsearch { hosts => "localhost:9200" index => "my_index" action => update document_id => "%{FieldId}" doc_as_upsert => true } }