gromit
February 9, 2016, 7:08am
1
Using Elasticsearch 2,2 I'm trying to update the field type for geoip.location (currently mapped as type 'number') to type geo_point using the following request:
myindex/_mapping/
{
"properties": {
"geoip.location": {
"type": "geo_point"
}
}
}
Result is:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Field name [geoip.location] cannot contain '.'"
}
],
"type": "mapper_parsing_exception",
"reason": "Field name [geoip.location] cannot contain '.'"
},
"status": 400
}
Any ideas how I can do this?
dadoonet
(David Pilato)
February 9, 2016, 7:45am
2
Something like:
{
"properties": {
"geoip": {
"type": "object",
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
That said, elasticsearch will refuse to do it as you can't change an existing field. You'll have to create a new field or type or index and reindex.
gromit
February 9, 2016, 8:01am
3
Ok, thanks. If I was to create a new template for this time based index, would it be like this?
{
"template" : "myindex*",
"settings" : {
"number_of_shards" : 5
},
"mappings": {
"properties" : {
"geoip": {
"type": "object",
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
}
dadoonet
(David Pilato)
February 9, 2016, 8:32am
4
Probably. I did not test it but it looks good.
Side note: please format your code when posting in discuss. It makes your posts more readable.