Merging Two Indexes


(Sumit Guptaa) #1

Hi all,

Can anybody tell me how we can merge two indicies..is there any mechanism in ES for merging index ....any help would be highly appreciated....Thanx

first index=>

{"message":"abc"}
{"message""def"}

Second Index=>

{"name":"sumit"}
{"name":"gupta"}

Regards,
Sumit Gupta


(Lukáš Vlček) #2

Hi,

what exactly do you mean by merging indices?

If you have an index A and index B and you want to have new index C with
would contain content from both indices A and B (and then you eventually
want to drop indices A and B) then such merging is not supported by ES out
of the box. But you can write a simple script to do it manually on your
side (pull all data from index A and index into C, pull all data from index
B and index into C, done).

If you just want to search across both indices A and B (as is they were a
single index C) then you can of course do it (
http://www.elasticsearch.org/guide/reference/api/multi-index.html or
http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html
).

Regards,
Lukas

On Wed, Aug 15, 2012 at 8:24 AM, Sumit Guptaa sumit.gupta.ngi@gmail.comwrote:

Hi all,

Can anybody tell me how we can merge two indicies..is there any mechanism
in
ES for merging index ....any help would be highly appreciated....Thanx

first index=>

{"message":"abc"}
{"message""def"}

Second Index=>

{"name":"sumit"}
{"name":"gupta"}

Regards,
Sumit Gupta

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Merging-Two-Indexes-tp4021708.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--

--


(Andrej) #3

Lukas is of course right, the easiest solution is to search over both
indices. Alternativly you can pull documents out of both indices and throw
them in a new one. But be careful with this solution: it does not work when
you exclude source fields, as these can not be retrieved again.

Am Mittwoch, 15. August 2012 12:56:01 UTC+2 schrieb Lukáš Vlček:

Hi,

what exactly do you mean by merging indices?

If you have an index A and index B and you want to have new index C with
would contain content from both indices A and B (and then you eventually
want to drop indices A and B) then such merging is not supported by ES out
of the box. But you can write a simple script to do it manually on your
side (pull all data from index A and index into C, pull all data from index
B and index into C, done).

If you just want to search across both indices A and B (as is they were a
single index C) then you can of course do it (
http://www.elasticsearch.org/guide/reference/api/multi-index.html or
http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html
).

Regards,
Lukas

On Wed, Aug 15, 2012 at 8:24 AM, Sumit Guptaa <sumit.g...@gmail.com<javascript:>

wrote:

Hi all,

Can anybody tell me how we can merge two indicies..is there any mechanism
in
ES for merging index ....any help would be highly appreciated....Thanx

first index=>

{"message":"abc"}
{"message""def"}

Second Index=>

{"name":"sumit"}
{"name":"gupta"}

Regards,
Sumit Gupta

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Merging-Two-Indexes-tp4021708.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--

--


(system) #4