How to omit a builtin type from mapping


(stelios) #1

Let's say I have a mapping like the below and don't want to map the
last_name, while using dynamic mapping.
In the tests I did indexing a document with fields not in the initial
mapping will cause these fields to be mapped as well. Which is
something I want but not for all fields.
I see the object type has an enabled feature. Anything similar for a
simple field?
{
"tweet" : {
"properties" : {
"person" : {
"type" : "object",
"properties" : {
"name" : {
"properties" : {
"first_name" : {"type" : "string"},
"last_name" : {"type" : "string"}
}
},
"sid" : {"type" : "string", "index" :
"not_analyzed"}
}
}
"message" : {"type" : "string"}
}
}
}

thanks
stelios


(Shay Banon) #2

you can set the "index" : "no" in the mapping for last_name, then it won't be indexed (and not stored, as this is the default), so it won't be added to the Document indexed.
On Friday, February 4, 2011 at 8:01 PM, stelios wrote:

Let's say I have a mapping like the below and don't want to map the
last_name, while using dynamic mapping.
In the tests I did indexing a document with fields not in the initial
mapping will cause these fields to be mapped as well. Which is
something I want but not for all fields.
I see the object type has an enabled feature. Anything similar for a
simple field?
{
"tweet" : {
"properties" : {
"person" : {
"type" : "object",
"properties" : {
"name" : {
"properties" : {
"first_name" : {"type" : "string"},
"last_name" : {"type" : "string"}
}
},
"sid" : {"type" : "string", "index" :
"not_analyzed"}
}
}
"message" : {"type" : "string"}
}
}
}

thanks
stelios


(system) #3