Applying updates to mappings using templates


(Jed Glazner) #1

Hey Guys,

So I'm working on a project where we are planning on creating several
indexes that all have several fields in common. We are not sure how many
indexes we will need but they will always 'extend' this base
schema/mapping. I thought we could use the template feature, but as I
discovered the templates are only read during index creation and indexes
that are based on this template do not know about the schema changes. I
don't want to manually get/modify/post mapping updates for dozens of schema
any type we add a new field (very likely to happen).

My question then is would it be useful to anyone else to have a feature for
automatically updating existing indexes based on the template when changes
to that template are made?

something like:

curl -XPUT http://localhost:9200/templates/my_template
{
"template": "my
*",

  • "update_index_mappings":true,*
    "mappings": {
    ...
    }
    }

Or where when updating a mapping specify a template to use?

curl -XPOST http://localhost:9200/my_index/_mapping
{

  • "template" : "my_template",*
    "mappings": {
    ...
    }
    }

Or if there already exists a way of doing this please let me know.

Thanks!

Jed

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bf02563f-49cf-4603-8743-c03116e9ba41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #2

FWIW, you can update mappings for multiple indexes if necessary:

curl -XPUT localhost:9200/a,b,c/type/_mapping

or

curl -XPUT localhost:9200/_all/type/_mapping

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6cb5a3f7-b86f-4b58-9efc-b1f6a8096bb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3