Update mapping

Hi,

I'm trying to update a mapping via the Java API. The code appears to
work, however, when I get the mapping it hasn't changed.

Here is what my code looks like:

IndicesAdminClient admin = client.admin().indices();
PutMappingRequest putRequest = new PutMappingRequest(INDEX_NAME);
putRequest.source(mapping());
putRequest.type("_default_");
putRequest.ignoreConflicts(true);
PutMappingResponse response =

admin.putMapping(putRequest).actionGet(30000);
if (response.acknowledged())
log.info("putMapping succeeded");

Note that the funciton "mapping()" returns my mapping as an
XContentBuilder object, including the new fields and other changes I
am trying to make.

This code runs and prints the success message, but when I query the
mapping from the command line, I get the old mapping. What am I doing
wrong?

You are updating the default mapping, are you saying that when you update
it and then do a get, you don't get it? Can you gist a curl recreation?

On Wed, May 2, 2012 at 11:52 PM, Frank LaRosa frank@studyblue.com wrote:

Hi,

I'm trying to update a mapping via the Java API. The code appears to
work, however, when I get the mapping it hasn't changed.

Here is what my code looks like:

   IndicesAdminClient admin = client.admin().indices();
   PutMappingRequest putRequest = new PutMappingRequest(INDEX_NAME);
   putRequest.source(mapping());
   putRequest.type("_default_");
   putRequest.ignoreConflicts(true);
   PutMappingResponse response =

admin.putMapping(putRequest).actionGet(30000);
if (response.acknowledged())
log.info("putMapping succeeded");

Note that the funciton "mapping()" returns my mapping as an
XContentBuilder object, including the new fields and other changes I
am trying to make.

This code runs and prints the success message, but when I query the
mapping from the command line, I get the old mapping. What am I doing
wrong?

I got the same issue with java api 0.19.4, and also with 0.19.3.

Putting new mappings work, but cant update. Code doesnt throw any exception or something.

PutMappingRequestBuilder rq = client.admin().indices().preparePutMapping("someIndex");
rq.setType("xxxx").setSource(TYPE_MAPPING_SOURCE);
rq.setIgnoreConflicts(true);

initial mapping source(TYPE_MAPPING_SOURCE) is something like this:
{
"xxxx" : {
"properties" : {
"someText" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}

and im trying to update it to:
{
"xxxx" : {
"properties" : {
"someText" : {
"type" : "string",
"index" : "no"
}
}
}
}

I also tried closing index before trying to update, but it doesnt work too.

When i set ignoreConflicts,
rq.setIgnoreConflicts(false);

api throws an exception
org.elasticsearch.index.mapper.MergeMappingException: Merge failed with failures {[mapper [someText] has different index values]}

Ferid Gürbüz

You can't change the index mapping setting of a field.

On Sun, May 27, 2012 at 5:45 PM, feridcelik feridcelik@gmail.com wrote:

I got the same issue with java api 0.19.4, and also with 0.19.3.

Putting new mappings work, but cant update. Code doesnt throw any exception
or something.

PutMappingRequestBuilder rq =
client.admin().indices().preparePutMapping("someIndex");
rq.setType("xxxx").setSource(TYPE_MAPPING_SOURCE);
rq.setIgnoreConflicts(true);

initial mapping source(TYPE_MAPPING_SOURCE) is something like this:
{
"xxxx" : {
"properties" : {
"someText" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}

and im trying to update it to:
{
"xxxx" : {
"properties" : {
"someText" : {
"type" : "string",
"index" : "no"
}
}
}
}

I also tried closing index before trying to update, but it doesnt work too.

When i set ignoreConflicts,
rq.setIgnoreConflicts(false);

api throws an exception
org.elasticsearch.index.mapper.MergeMappingException: Merge failed with
failures {[mapper [someText] has different index values]}

Ferid Gürbüz

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Update-mapping-tp3957288p4018140.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

As far as I know if a mapping is already defined for the index/document
type, you can't change any of the following setting of a field: core type,
index, store, term_vector, index_analyzer or search_analyzer

-- Tanguy
Twitter: @tlrx

Le dimanche 27 mai 2012 17:45:50 UTC+2, ferid çelik a écrit :

I got the same issue with java api 0.19.4, and also with 0.19.3.

Putting new mappings work, but cant update. Code doesnt throw any
exception
or something.

PutMappingRequestBuilder rq =
client.admin().indices().preparePutMapping("someIndex");
rq.setType("xxxx").setSource(TYPE_MAPPING_SOURCE);
rq.setIgnoreConflicts(true);

initial mapping source(TYPE_MAPPING_SOURCE) is something like this:
{
"xxxx" : {
"properties" : {
"someText" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}

and im trying to update it to:
{
"xxxx" : {
"properties" : {
"someText" : {
"type" : "string",
"index" : "no"
}
}
}
}

I also tried closing index before trying to update, but it doesnt work
too.

When i set ignoreConflicts,
rq.setIgnoreConflicts(false);

api throws an exception
org.elasticsearch.index.mapper.MergeMappingException: Merge failed with
failures {[mapper [someText] has different index values]}

Ferid Gürbüz

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Update-mapping-tp3957288p4018140.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

Hi Shay,

Can we change from dynamic:false to dynamic:true in case of custom mapping?

Also it would be useful to know what all can we change in the mapping
which doesn't require the re-indexing of the older data?

Thanks in advance..!!

On Wednesday, May 30, 2012 1:55:20 AM UTC-7, kimchy wrote:

You can't change the index mapping setting of a field.

On Sun, May 27, 2012 at 5:45 PM, feridcelik <ferid...@gmail.com<javascript:>

wrote:

I got the same issue with java api 0.19.4, and also with 0.19.3.

Putting new mappings work, but cant update. Code doesnt throw any
exception
or something.

PutMappingRequestBuilder rq =
client.admin().indices().preparePutMapping("someIndex");
rq.setType("xxxx").setSource(TYPE_MAPPING_SOURCE);
rq.setIgnoreConflicts(true);

initial mapping source(TYPE_MAPPING_SOURCE) is something like this:
{
"xxxx" : {
"properties" : {
"someText" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}

and im trying to update it to:
{
"xxxx" : {
"properties" : {
"someText" : {
"type" : "string",
"index" : "no"
}
}
}
}

I also tried closing index before trying to update, but it doesnt work
too.

When i set ignoreConflicts,
rq.setIgnoreConflicts(false);

api throws an exception
org.elasticsearch.index.mapper.MergeMappingException: Merge failed with
failures {[mapper [someText] has different index values]}

Ferid Gürbüz

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Update-mapping-tp3957288p4018140.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--