Update mapping

Hi

I have mapping with 'lat' and 'lon' defined as double

"location" : {
"dynamic" : "true",
"properties" : {
...
...
"lon_lat" : {
"dynamic" : "true",
"properties" : {
"lon" : {
"type" : "double"
},
"lat" : {
"type" : "double"
}
}
},
...

I want to make the type of "lon_lat"

"location" : {
"properties" : {
"lon_lat" : { "type" : "geo_point"}
}
},

I get error when I try to update the mapping
{"error":"MergeMappingException[Merge failed with failures {[Can't
merge a non object mapping [lon_lat] with an object mapping
[lon_lat]]}]","status":400}

Reading previous posts, looks like this is expected. And one of the
solutions proposed is to recreate the index with new mapping.

In my case though, there are no existing records with "lon_lat"

curl -XPOST 'http://localhost:9200/test/test/_search?pretty=true' -d
' { "filter" : { "exists" : { "field" : "location.lon_lat" } } }'
{
"took" : 28,
"timed_out" : false,
"_shards" : {
"total" : 20,
"successful" : 20,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

Does it make anything easier for me? Or do I still need to recreate
the index?

What is the best way to build the new index while keeping it in sync
with the existing index in production environment?

Thanks
Gaurav

You can't change existing mapping type, you need to create a new index with
the correct mapping and index the data again.

On Tue, May 1, 2012 at 2:08 AM, Gaurav Vijayvargiya <gvijayvargiya@gmail.com

wrote:

Hi

I have mapping with 'lat' and 'lon' defined as double

"location" : {
"dynamic" : "true",
"properties" : {
...
...
"lon_lat" : {
"dynamic" : "true",
"properties" : {
"lon" : {
"type" : "double"
},
"lat" : {
"type" : "double"
}
}
},
...

I want to make the type of "lon_lat"

"location" : {
"properties" : {
"lon_lat" : { "type" : "geo_point"}
}
},

I get error when I try to update the mapping
{"error":"MergeMappingException[Merge failed with failures {[Can't
merge a non object mapping [lon_lat] with an object mapping
[lon_lat]]}]","status":400}

Reading previous posts, looks like this is expected. And one of the
solutions proposed is to recreate the index with new mapping.

In my case though, there are no existing records with "lon_lat"

curl -XPOST 'http://localhost:9200/test/test/_search?pretty=true' -d
' { "filter" : { "exists" : { "field" : "location.lon_lat" } } }'
{
"took" : 28,
"timed_out" : false,
"_shards" : {
"total" : 20,
"successful" : 20,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}

Does it make anything easier for me? Or do I still need to recreate
the index?

What is the best way to build the new index while keeping it in sync
with the existing index in production environment?

Thanks
Gaurav

OK, makes sense. Thanks

Gaurav

On Wednesday, May 2, 2012 9:18:00 AM UTC-7, kimchy wrote:

You can't change existing mapping type, you need to create a new index
with the correct mapping and index the data again.

On Tue, May 1, 2012 at 2:08 AM, Gaurav Vijayvargiya wrote:

Hi

I have mapping with 'lat' and 'lon' defined as double

"location" : {
"dynamic" : "true",
"properties" : {
...
...
"lon_lat" : {
"dynamic" : "true",
"properties" : {
"lon" : {
"type" : "double"
},
"lat" : {
"type" : "double"
}
}
},
...

I want to make the type of "lon_lat"

"location" : {
"properties" : {
"lon_lat" : { "type" : "geo_point"}
}
},

I get error when I try to update the mapping
{"error":"MergeMappingException[Merge failed with failures {[Can't
merge a non object mapping [lon_lat] with an object mapping
[lon_lat]]}]","status":400}

Reading previous posts, looks like this is expected. And one of the
solutions proposed is to recreate the index with new mapping.

In my case though, there are no existing records with "lon_lat"

curl -XPOST 'http://localhost:9200/test/test/_search?pretty=true' -d
' { "filter" : { "exists" : { "field" : "location.lon_lat" } } }'
{
"took" : 28,
"timed_out" : false,
"_shards" : {
"total" : 20,
"successful" : 20,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}

Does it make anything easier for me? Or do I still need to recreate
the index?

What is the best way to build the new index while keeping it in sync
with the existing index in production environment?

Thanks
Gaurav

Does the stored mapping matter? Can I just specify a new mapping every time
I add or update a document?

On Wednesday, May 2, 2012 11:18:00 AM UTC-5, kimchy wrote:

You can't change existing mapping type, you need to create a new index
with the correct mapping and index the data again.

On Tue, May 1, 2012 at 2:08 AM, Gaurav Vijayvargiya <
gvijayvargiya@gmail.com> wrote:

Hi

I have mapping with 'lat' and 'lon' defined as double

"location" : {
"dynamic" : "true",
"properties" : {
...
...
"lon_lat" : {
"dynamic" : "true",
"properties" : {
"lon" : {
"type" : "double"
},
"lat" : {
"type" : "double"
}
}
},
...

I want to make the type of "lon_lat"

"location" : {
"properties" : {
"lon_lat" : { "type" : "geo_point"}
}
},

I get error when I try to update the mapping
{"error":"MergeMappingException[Merge failed with failures {[Can't
merge a non object mapping [lon_lat] with an object mapping
[lon_lat]]}]","status":400}

Reading previous posts, looks like this is expected. And one of the
solutions proposed is to recreate the index with new mapping.

In my case though, there are no existing records with "lon_lat"

curl -XPOST 'http://localhost:9200/test/test/_search?pretty=true' -d
' { "filter" : { "exists" : { "field" : "location.lon_lat" } } }'
{
"took" : 28,
"timed_out" : false,
"_shards" : {
"total" : 20,
"successful" : 20,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}

Does it make anything easier for me? Or do I still need to recreate
the index?

What is the best way to build the new index while keeping it in sync
with the existing index in production environment?

Thanks
Gaurav

Hi,

I have created new index with mapping . Can you please let me know how to
index the data. Here I have push data from couchbase to Elasticsearch.
Also I have one question how to disable field in Elasticsearch which is
not required to me?

Thanks in advance........

On Wednesday, 2 May 2012 21:48:00 UTC+5:30, kimchy wrote:

You can't change existing mapping type, you need to create a new index
with the correct mapping and index the data again.

On Tue, May 1, 2012 at 2:08 AM, Gaurav Vijayvargiya <gvijay...@gmail.com<javascript:>

wrote:

Hi

I have mapping with 'lat' and 'lon' defined as double

"location" : {
"dynamic" : "true",
"properties" : {
...
...
"lon_lat" : {
"dynamic" : "true",
"properties" : {
"lon" : {
"type" : "double"
},
"lat" : {
"type" : "double"
}
}
},
...

I want to make the type of "lon_lat"

"location" : {
"properties" : {
"lon_lat" : { "type" : "geo_point"}
}
},

I get error when I try to update the mapping
{"error":"MergeMappingException[Merge failed with failures {[Can't
merge a non object mapping [lon_lat] with an object mapping
[lon_lat]]}]","status":400}

Reading previous posts, looks like this is expected. And one of the
solutions proposed is to recreate the index with new mapping.

In my case though, there are no existing records with "lon_lat"

curl -XPOST 'http://localhost:9200/test/test/_search?pretty=true' -d
' { "filter" : { "exists" : { "field" : "location.lon_lat" } } }'
{
"took" : 28,
"timed_out" : false,
"_shards" : {
"total" : 20,
"successful" : 20,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}

Does it make anything easier for me? Or do I still need to recreate
the index?

What is the best way to build the new index while keeping it in sync
with the existing index in production environment?

Thanks
Gaurav

--
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.
For more options, visit https://groups.google.com/groups/opt_out.