I have a master branch in my code repository. To enable code search we use elastic search. Any time a new branch is created it needs to be made searchable, which mean indexing that branch of code. Since when the branch is created, it is a copy of the master branch, I would like to copy the index of master branch and associate the copy to the new branch. It is like doing a file copy and then creating a pointer from new repository to this index. Couple of questions
- Is this possible?
- A lot of places I have read about re-index api. Will the re-index go through the processing of indexing or would it just copy the index?
reindex is not copying the data from a to b but really running a new index operation for each document. The nice part is, you can combine it with a query to only include those documents that you need.
Alternative you could also use snapshot/restore, but then you would first have to make a snapshot and then make sure that you delete documents that are part of the snapshot but not part of the branch.
Maybe you can rethink your data modeling, and have all commits from a repository in the same index, and have a field, that is an array, that contains the branches that this commit is part from? This way there would not be any need for reindexing.
You can also clone an index with the clone API, which should be faster than a re-index or restoring a snapshot.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.