palantir / stash-codesearch-plugin

Provides global repository, commit, and file content search for Atlassian Stash instances
Apache License 2.0
62 stars 20 forks source link

initial index: scs-search alias never reassigned? #13

Closed memory closed 3 years ago

memory commented 9 years ago

Post-install, the plugin appeared to successfully index all of the repositories in our stash deployment, but then stopped and searching returned no results. Poking around on the elasticsearch cluster revealed that it had created two indices, one aliased "scs-search" (with <10 documents and <70kb of data) and one called "scs-update" with 7GB of data and 5M documents.

Being a bright lad, I guessed that if I moved the "scs-search" alias to point at the index with all of the actual documents in it, that might make the search function happier and sure enough it did -- but shouldn't the plugin have done this itself? There was nothing in the logs to suggest that it had tried and failed or anything else; it simply stopped appending docs to the index except when new commits came in.

terabyte commented 8 years ago

I haven't seen this before, but it is interesting. Did you, by chance, upgrade from one version to another at some point? Failing that, I'd agree that whatever happened is definitely a bug.

memory commented 8 years ago

Nope, this was the very first time we set up codesearch. However I will confess that we built a slightly amended jar because our elasticsearch cluster is not on localhost and has a different cluster name than the default expected. I wouldn't have expected that to have any effect on the index naming/tagging code, but here's the full diff:

diff --git a/src/main/resources/elasticsearch.yml b/src/main/resources/elasticsearch.yml
index ff85e58..fdcbe48 100644
--- a/src/main/resources/elasticsearch.yml
+++ b/src/main/resources/elasticsearch.yml
@@ -1,4 +1,4 @@
-cluster.name: stash-codesearch
-client.transport.cluster.host: 127.0.0.1
+cluster.name: devops-es
+client.transport.cluster.host: devops-es-master.internal
 client.transport.cluster.port: 9300-9305
 client.transport.sniff: true