Referencing to another index in elasticsearch Referencing to another index in elasticsearch mongoose mongoose

Referencing to another index in elasticsearch


I think that you should put all your data in the same index, and differentiate them by type.

But with your current indexes, you could execute a unique query on two indexes by creating an alias. An alias can be declared on top of one or many indexes (or aliases). So in your case, create an index on top of your "user" and "project" indexes, and execute your query on the alias.

Official doc (it's very easy to set up an alias):http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html


You can search in more than one indices at once. I am using this

var collection = ['assets','users'];var types = ['asset', 'user'];asset.search({query_string: {query: data}},{index:collection, type: types}, function(err, results){//your result here});

I have users and assets collection in mongodb for which mongoosastic creates indices users and assets and gives type user and asset.

Above code worked for me. Hope this helps.