richardwilly98/elasticsearch-river-mongodb

Allow alias in place of index

j0hnsmith opened this issue · 2 comments

I have an index files_v1 with an index files pointing to it. All is good when I use 'files_v1' as the index name in the mongo river config, but when I use the alias ('files') I get this error

[2013-10-31 12:24:55,331][WARN ][river.mongodb            ] [Arishem the Judge] [mongodb][mongodb] failed to create index [files], disabling river...
org.elasticsearch.indices.InvalidIndexNameException: [files] Invalid index name [files], an alias with the same name already exists
    at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validate(MetaDataCreateIndexService.java:532)
    at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.access$200(MetaDataCreateIndexService.java:86)
    at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$2.execute(MetaDataCreateIndexService.java:171)
    at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:285)
    at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:143)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:679)

If the given index is an alias, mongo river should use the index it points to rather than attempt to create a new index.

@j0hnsmith the river will now use the alias transparently if it has been setup.

Great, thx.