Elasticsearch 6.2.4 Preparing for removal of mapping types


#1

Hi Team,

Could you please help to clear a confusion I have with regards to the future removal of mapping types?

According to the documenation:

  • the _default_ mapping type is deprecated and will be removed in 7.x
  • the preferred type name is _doc

Given the above, I am in the process of changing the templates. However, I noticed that when Logstash sends data to Elasticsearch, the type is doc and not _doc by default (I did not set any specific type in logstash.conf).

I verified that the type in my index is of type doc because GET {index}/_doc/{id} does not work and this GET {index}/doc/{id} works.

So I assuming, in my templates I should define the mapping for doc type and not _doc even though in the above documentation the recommended type is _doc?

Cheers,


(David Pilato) #2

I think that the rest of the stack is going to be updated to use _doc indeed. I did not check if it has been done or not yet and is ready for 6.3.


#3

If suddenly the stack switches from doc to _doc, I think it might cause some problems, because:

  • I used to use _default_ in templates which basically applies the mappings regardless of type.
  • Now, I am switching to doc because that is what stuff from Logstash is mapped to.
  • In the future, Logstash switches to _doc cos the stack switched to _doc and suddenly my mappings which are defined only for doc type stop being applied :sweat:.

Is what I'm thinking above possible?

If it is possible, does that mean to prevent the above problem from happening, I should define two exactly the same set of mappings one for _doc and one for doc - basically in anticipation of the stack switch from doc to _doc?


(David Pilato) #4

I think you can anticipate what will happen with:

My 0.05 cents.


#5

Thanks for the link.

So if I understood the github issue correctly then _doc will be used going forward for Logstash.

So unless I change my logstash.conf to explicitly set documents sent by Logstash to retain the old type doc, it will be changed to _doc. Therefore, I will now have old indexes with type doc and new indexes with type _doc which might or might not cause some subsequent problems.

When 7.x it's gonna be adventurous :smile:.


(David Pilato) #6

Should not be an issue hopefully. Worse case you can always use the reindex API to rename old doc type to _doc type?


#7

Agreed, in the worst case, I would have to reindex. Thanks again!


(system) #8

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