Help on merging 2 indices in production

Hi

i have 2 indices being used by an app which is in production. Now, i need to merge these 2 indices so that there is minimal code change or activity to be done from my end. The activity should also not break the existing one in production. Post merge, the app in production should use the newly merged index.

Please suggest a way to do the merge with less hassles.

Using index aliases could help to virtually merge the content of both indices and appears as only one.
Note that will work only for read operations.

all my indices need to suupport read-write operations. how should my approach be ?

You must reindex then.

few field mappings structure are different e.g.

First index:
"parseOutputs": [
{
"action": {
"name": "transfer"
},
"product": {}
}
]

Second index:
"action": [
"apply"
]

i have many such kind of fields where structure differs. in that case, will reindex work (because mapping changes after i normalise the representation those collided fields with new mapping) ?

So why do you need to merge both indices?

there are 2 features in the app which were developed in parallel. each has its own index. Also, one index is a subset of another. which means, i can use only one index for both the features after making changes to fields / object representation in unison. 1 index is always redundant so thought of merging both of them into one.

Could you illustrate with a concrete example? I don't understand why you would need to do that.
Either data is not useful and you can drop one of the index or the documents need to be merged as a single one coming from both indices in which case you need to reindex by reading the sources, making "joins", then indexing the result.

both the indexes store same data but with different key names (few), different object structure for values (few).

I don't get it.

Anyway, I'd do:

{
   "parseOutputs":[
      {
         "action":{
            "name":"transfer"
         },
         "product":{

         }
      }
   ],
   "action":[
      "apply"
   ]
}

ok. i'll try with the way you suggested.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.