Skip to content

elasticsearch: initial indexing: project snippets are indexed twice

The following discussion from !14095 (merged) should be addressed:

  • @toupeira started a discussion: (+2 comments)

    Hmm come to think of it, this is only needed for PersonalSnippet's since ProjectSnippet's are included in Elastic::ProjectsSearch::INDEXED_ASSOCIATIONS, so IndexRecordService should catch them already.

When running gitlab:elastic:index, we run gitlab:elastic:index_projects - which indexes the relevant ProjectSnippet for the limited projects - followed by gitlab:elastic:index_snippets - which indexes all snippets. So they get indexed twice in the global case, unnecessarily.

We could make index_snippets only index personal snippets. However, in the limited elasticsearch case, this would be broken.

At present, the snippet search service does not take account of the elasticsearch limited settings - it assumes all snippets are always indexed, even when limitations are active. So at the global level, with limited indexing enabled, it still uses elasticsearch to find results.

We need to resolve this before we can remove the duplication, I think.

Edited by Nick Thomas