Reuse of mappings

(bryan rasmussen) #1

I have a couple of types of documents that are essentially the same - so as I read this

Fields with:
the same name

in the same index

in different mapping types

map to the same field internally,

and must have the same mapping.

if it's inside the same index I don't actually have to define a mapping for a field with the name 'name' under document type active_product if there is already a definition of a field with that name under type product because it will be given the same mapping by elasticsearch automatically.


(Mark Walkom) #2

Depends how you defined the original mapping, if you created it against a single type then it won't work.

(bryan rasmussen) #3

ok well if I have

"mappings": {
    "product" : {
        "properties" : {
            "currency" : {"type" : "string", "index": "not_analyzed"},

and then I create a new document type "active_product" in the same index do I have to do a mapping for a currency field for that document type or will it just map active.product currency the same way that product currency is mapped ( if not is there a way to specify that this type inherits all of this types mappings plus defines it's own)?

(Guilherme Maranhao) #4

Hi Bryan,

I'm facing the same issue in my index mapping. How did you solve it? I know I've read something about it in 2.3 version, but I can't find any docs related to it in 5.0.

Thank you,


(system) #5