Elasticsearch only finds first occurrence in a file
Overview
Customer has enabled elasticsearch and run indexing sudo gitlab-rake gitlab:elastic:index_repositories
when searching for a string occurrence only the first result is shown in the view. The string exists in the file multiple times.
Actual
Only first occurrence of string is shown from file (in search view), even if the file contains occurrences.
Expected
Show all or more occurrences of searched string in search view.
Customer communication
I just enabled elasticsearch in our gitlab instance and our code has been indexed. If I for instance search for a variable name in within a project, the search only displays the first occurence of the variable name in each file. To me this looks like a bug as I expect to see all occurences of a string within files. We're on 8.8.3-ee. Yes, I ran the indexer. I just tried to start it again and it did non generate any output in the shell so I guess it has no more repos that needs indexing? Is there any way to force reindexing? Although I'd like to avoid that because it takes several hours to index our codebase.
In the following screenshot you can see the output when I search for "branch" in one of our projects. The string branch occurs several times in that file. In this case it's a ruby on rails project. But for our other projects written in C++ this issue does occur as well.
//cc @vsizov