Skip to content

Elasticsearch v6 - migrate from parent/child relationships to joins

Mario de la Ossa requested to merge elasticsearch_v6 into master

What does this MR do?

Since ES6 only allows one mapping type per index and we need to have documents in a single index in order to use join datatypes, I had to make quite a few changes to how we deal with elasticsearch in the codebase:

  • I changed all our document types to be doc
  • In order to still be able to query per type, I implemented a custom type field in our elasticsearch documents, called simply type
  • The join type was created granularly, that is to say, it has a mapping per type: project->issue, project->blob, etc.
  • We now use an es_id for elasticsearch's _id field. This is comprised of the model class name and the ID in the database
  • Because of the es_id change a lot of changes were required to the elasticsearch-model gem. These changes have been encapsulated in the ee/lib/gem_extensions folder and are injected inside the elasticsearch client initializer.

Breaking changes

We can no longer support Elasticsearch versions under 5.6. This is because the join field is only supported from versions 5.6 and upwards.

Wiki searches now must use a new type: wiki_blob. I've edited existing usages in the codebase but this is good to keep in mind

What are the relevant issue numbers?

#4218 (closed)

Does this MR meet the acceptance criteria?

Closes #4218 (closed)

Edited by Nick Thomas

Merge request reports

Loading