Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

hawkwang opened this issue Nov 6, 2015 · 5 comments

Comments

@hawkwang
Copy link

@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
Copy link
Contributor

@s1monw 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
Copy link

@isapir 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
Copy link
Contributor

@clintongormley 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
Copy link

@biancazzurri biancazzurri commented 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

@dadoonet
Copy link
Member

@dadoonet dadoonet commented May 10, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.