Christopher,
I don't think that the code that you posted here actually creates any
mappings. When you are creating mapping without creating an index the root
"mappings" element is not needed.
To add a property, you can repost the new mapping that includes properties
that you need:
curl -XPUT 'http://localhost:9200/auuser1/user1/_mapping' -d '{
"user1" : {
"_all" : {"enabled" : false},
"properties" : {
"UserEmail" : {"type" : "string", "index" : "analyzed",
"analyzer" : "keyword"},
"Uid": {"type" : "string", "index" : "analyzed","analyzer" :
"keyword"},
"Name": {"type" : "string", "index" : "analyzed", "analyzer" :
"standard"},
"Location": {"type" : "string", "index" : "analyzed",
"analyzer" : "standard"},
"Description": {"type" : "string", "index" : "analyzed",
"analyzer" : "snowball"},
"Password" : {"type" : "string" },
"Private" : {"type" : "boolean" }
}
}
}'
Or just post mapping with new elements:
curl -XPUT 'http://localhost:9200/auuser1/user1/_mapping' -d '{
"user1" : {
"_all" : {"enabled" : false},
"properties" : {
"Private" : {"type" : "boolean" }
}
}
}'
In both cases elasticsearch will try to merge the new mapping with existing
mapping, and since it cannot delete existing properties, it will only add
the new properties to the mapping.
On Sunday, October 21, 2012 10:02:39 PM UTC-4, Christopher Jennewein wrote:
How do I add properties to a mapping and add values to pre-existing items?
On Saturday, October 20, 2012 6:17:25 PM UTC-7, kimchy wrote:
No, you can't delete a property from a mapping.
On Oct 21, 2012, at 1:45 AM, Christopher Jennewein <
christophe...@gmail.com> wrote:
And for future reference, is there a way to delete a property from the
mapping?
On Saturday, October 20, 2012 1:09:35 PM UTC-7, Christopher Jennewein
wrote:
Hi, I'm new to ES and just joined a project that's been using it for
awhile, so they have everything up and running. I'm now trying to extend
the mapping of one of their indices, but having a hard time figuring how to
do it and how to add a value for every index that already exists.
Here is a portion of the code that created their mapping:
curl -XPUT 'http://localhost:9200/auuser1/user1/_mapping' -d '{
"mappings": {
"user1" : {
"_all" : {"enabled" : false},
"properties" : {
"UserEmail" : {"type" : "string",
"index" : "analyzed", "analyzer" : "keyword"},
"Uid": {"type" : "string", "index" :
"analyzed","analyzer" : "keyword"},
"Name": {"type" : "string", "index" :
"analyzed", "analyzer" : "standard"},
"Location": {"type" : "string", "index"
: "analyzed", "analyzer" : "standard"},
"Description": {"type" : "string",
"index" : "analyzed", "analyzer" : "snowball"},
"Password" : {"type" : "string" }
}
}
}
}'
I just need to add one property: "Private" : {"type" : "boolean"}
I've tried running the above with my property included, but when I
perform a search (curl -XGET '
http://localhost:9200/auuser1/user1/_search') it doesn't show my new
property.
How can I add my new property and set a default value for all existing
entries?
--
--