Index update script


(Vinicius Carvalho) #1

Is it possible to update the whole index using a script? Let me give an
example:

on my curent index I have a mapping:

{
"name" : "string"
}

I'd like to include an extra field on every document, called auto_complete,
and have the name field stored there, but using a different analyzer
(EdgeNGram for instance), so I can change the mapping, and later run a
single script to do that.

I know I could just go over the api and do doc by doc, just trying to
understand if there's an easier way around.

Regards


(Shay Banon) #2

No, there isn't an option to do that in elasticsearch itself. You probably
are better off simply reindexing the data (from the existing index for
example), or simply taking into account that some docs will have that field
missing.

On Wed, Jul 18, 2012 at 10:36 AM, Vinicius Carvalho <
viniciusccarvalho@gmail.com> wrote:

Is it possible to update the whole index using a script? Let me give an
example:

on my curent index I have a mapping:

{
"name" : "string"
}

I'd like to include an extra field on every document, called
auto_complete, and have the name field stored there, but using a different
analyzer (EdgeNGram for instance), so I can change the mapping, and later
run a single script to do that.

I know I could just go over the api and do doc by doc, just trying to
understand if there's an easier way around.

Regards


(system) #3