same field names may raise confliction with different type and analyzer #14575

Closed
hawkwang opened this Issue Nov 6, 2015 · 5 comments

Comments

Projects
None yet
6 participants
@hawkwang

hawkwang commented Nov 6, 2015

Here is the statement about how this happens, see as follows:

curl -XPUT 'localhost:9200/company?pretty' -d '
{
"mappings": {
"basic": {
"properties": {
"id" : {"type" : "string", "index" : "not_analyzed"},
"title" : {
"type" : "string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
},
"djjg" : {"type" : "string", "index" : "not_analyzed"}
}
},
"investor": {
"_parent": {
"type": "basic"
},
"properties": {
"title" : {"type" : "string", "index" : "not_analyzed"},
"type" : {"type" : "string", "index" : "not_analyzed"}
}
}
}

}'

The following error messages occurs:

{
"error" : {
"root_cause" : [ {
"type" : "mapper_parsing_exception",
"reason" : "mapping [investor]"
} ],
"type" : "mapper_parsing_exception",
"reason" : "mapping [investor]",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "Mapper for [title] conflicts with existing mapping in other types:\n[mapper [title] has different [index] values, mapper [title] has different [doc_values] values, cannot change from disabled to enabled, mapper [title] has different [analyzer], mapper [title] is used by multiple types. Set update_all_types to true to update [omit_norms] across all types., mapper [title] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [title] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]"
}
},
"status" : 400

}

I guess this error is raised due to same "title" fields used in parent and child mode :-)
Of cause, I can change the second one to "name", and that is fine.
But I think it should be not a big problem.
Any hint???

Regards,
Hawk

@s1monw

This comment has been minimized.

Show comment
Hide comment
@s1monw

s1monw Nov 6, 2015

Contributor

I guess this error is raised due to same "title" fields used in parent and child mode :-)
Of cause, I can change the second one to "name", and that is fine.

yes that's the reason, even though they seem to be isolated they are not. You have to either specify the same analyzer and type or use a different name.

Contributor

s1monw commented Nov 6, 2015

I guess this error is raised due to same "title" fields used in parent and child mode :-)
Of cause, I can change the second one to "name", and that is fine.

yes that's the reason, even though they seem to be isolated they are not. You have to either specify the same analyzer and type or use a different name.

@s1monw s1monw closed this Nov 6, 2015

@isapir

This comment has been minimized.

Show comment
Hide comment
@isapir

isapir Nov 10, 2015

Is there a blog post or some article explaining this? I'm trying to upgrade from ES1.7.1 to ES2.0.0 and I'm getting this error, and I don't understand what Set update_all_types to true means. Where do I set update_all_types?

Would removing and reindexing all of the data fix this for me? Or is the problem with the mappings?

2015-11-08 19:22:34 Commons Daemon procrun stderr initialized
Exception in thread "main" tion: unable to upgrade the mappings for the index [test1], reason: [Mapper for [_all] conflicts with existing mapping in other types:
[mapper [_all] has different [analyzer], mapper [_all] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [_all] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]]
Likely root cause: java.lang.IllegalArgumentException: Mapper for [_all] conflicts with existing mapping in other types:
[mapper [_all] has different [analyzer], mapper [_all] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [_all] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]
    at org.elasticsearch.index.mapper.FieldTypeLookup.checkCompatibility(FieldTypeLookup.java:117)
    at org.elasticsearch.index.mapper.MapperService.checkNewMappersCompatibility(MapperService.java:345)
    at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:296)
    at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:242)
    at org.elasticsearch.cluster.metadata.MetaDataIndexUpgradeService.checkMappingsCompatibility(MetaDataIndexUpgradeService.java:329)
    at org.elasticsearch.cluster.metadata.MetaDataIndexUpgradeService.upgradeIndexMetaData(MetaDataIndexUpgradeService.java:112)
    at org.elasticsearch.gateway.GatewayMetaState.pre20Upgrade(GatewayMetaState.java:226)
    at org.elasticsearch.gateway.GatewayMetaState.<init>(GatewayMetaState.java:85)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at <<<guice>>>
    at org.elasticsearch.node.Node.<init>(Node.java:198)
    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

isapir commented Nov 10, 2015

Is there a blog post or some article explaining this? I'm trying to upgrade from ES1.7.1 to ES2.0.0 and I'm getting this error, and I don't understand what Set update_all_types to true means. Where do I set update_all_types?

Would removing and reindexing all of the data fix this for me? Or is the problem with the mappings?

2015-11-08 19:22:34 Commons Daemon procrun stderr initialized
Exception in thread "main" tion: unable to upgrade the mappings for the index [test1], reason: [Mapper for [_all] conflicts with existing mapping in other types:
[mapper [_all] has different [analyzer], mapper [_all] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [_all] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]]
Likely root cause: java.lang.IllegalArgumentException: Mapper for [_all] conflicts with existing mapping in other types:
[mapper [_all] has different [analyzer], mapper [_all] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [_all] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]
    at org.elasticsearch.index.mapper.FieldTypeLookup.checkCompatibility(FieldTypeLookup.java:117)
    at org.elasticsearch.index.mapper.MapperService.checkNewMappersCompatibility(MapperService.java:345)
    at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:296)
    at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:242)
    at org.elasticsearch.cluster.metadata.MetaDataIndexUpgradeService.checkMappingsCompatibility(MetaDataIndexUpgradeService.java:329)
    at org.elasticsearch.cluster.metadata.MetaDataIndexUpgradeService.upgradeIndexMetaData(MetaDataIndexUpgradeService.java:112)
    at org.elasticsearch.gateway.GatewayMetaState.pre20Upgrade(GatewayMetaState.java:226)
    at org.elasticsearch.gateway.GatewayMetaState.<init>(GatewayMetaState.java:85)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at <<<guice>>>
    at org.elasticsearch.node.Node.<init>(Node.java:198)
    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
@clintongormley

This comment has been minimized.

Show comment
Hide comment
@clintongormley

clintongormley Nov 16, 2015

Member

Yeah during upgrade you can't specify that option (see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html#merging-conflicts for where you can use it).

Essentially you need to fix or delete this index before upgrading. The migration plugin will help you to spot problematic indices before upgrading.

Member

clintongormley commented Nov 16, 2015

Yeah during upgrade you can't specify that option (see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html#merging-conflicts for where you can use it).

Essentially you need to fix or delete this index before upgrading. The migration plugin will help you to spot problematic indices before upgrading.

@biancazzurri

This comment has been minimized.

Show comment
Hide comment
@biancazzurri

biancazzurri May 10, 2017

Please somebody explain why is this an expected behavior? To me it seems that its a non correct one. To my understanding there should be no connection between fields in different type

Please somebody explain why is this an expected behavior? To me it seems that its a non correct one. To my understanding there should be no connection between fields in different type

@dadoonet

This comment has been minimized.

Show comment
Hide comment
@dadoonet

dadoonet May 10, 2017

Member

Please ask your question on discuss.elastic.co where we can certainly help.

Member

dadoonet commented May 10, 2017

Please ask your question on discuss.elastic.co where we can certainly help.

@alonsoir alonsoir referenced this issue in alonsoir/demo-kafka-elastic May 16, 2018

Closed

About an exception when i start demo #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment