Java Elasticsearch 1.2.1 异常:解析后根类型映射不为空
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24254081/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Elasticsearch 1.2.1 exception: Root type mapping not empty after parsing
提问by Mark
After updating to Elasticsearch 1.2.1
I keep getting the following exception on the following mapping:
更新到 Elasticsearch 后,1.2.1
我在以下映射中不断收到以下异常:
{
"tags": {
"properties": {
"tags": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
This is the exception:
这是例外:
Caused by: org.elasticsearch.index.mapper.MapperParsingException: Root type mapping not empty after parsing! Remaining fields: [tags : {properties={tags={index=not_analyzed, type=string}}}]
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:265)
at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:189)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:387)
at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:253)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.execute(MetaDataCreateIndexService.java:363)
Why is that?
这是为什么?
采纳答案by John Petrone
@Mark this appears to be a bug in 1.2.X. There have been multiple others that have reported similar issues, I'll link to the tickets below. Basically it appears that they tightened up on syntax for mappings in 1.2.X but they appear to have caused some problems with previously valid mappings. Yours is one example.
@Mark 这似乎是 1.2.X 中的一个错误。已经有多个其他人报告了类似的问题,我将链接到下面的票证。基本上,他们似乎收紧了 1.2.X 中映射的语法,但他们似乎对以前有效的映射造成了一些问题。你的就是一个例子。
I'd suggest you open a bug report - more power in numbers. Happy to chime in saying "me too" if you open a ticket, as I've recreated the problem on 1.2.1 .
我建议你打开一个错误报告 - 数字更强大。如果您打开一张票,很高兴插话说“我也是”,因为我已经在 1.2.1 上重现了这个问题。
For now I've been able to the following to work which I believe gives you the same desired result:
现在,我已经能够进行以下工作,我相信这会给您带来相同的预期结果:
curl -XPUT localhost:9200/yourindexname -d
'{
"mappings":
{
"tags":
{
"properties":
{
"tags":
{
"type":"string",
"index":"not_analyzed"
}
}
}
}
}'
Tickets:
门票:
https://github.com/elasticsearch/elasticsearch/issues/6414
https://github.com/elasticsearch/elasticsearch/issues/6414
https://github.com/elasticsearch/elasticsearch/issues/6304
https://github.com/elasticsearch/elasticsearch/issues/6304
回答by Akash Yadav
This will help you
这会帮助你
you will get want you want to do
你会得到你想做的事
curl -XPUT localhost:9200/new_index -d '
{
"mappings": {
"tags": {
"properties": {
"tags": {
"type":"string",
"index":"not_analyzed"
}
}
}
}
}'
or you can also do this way
或者你也可以这样做
curl -XPUT localhost:9200/new_index/new_index_type/_mappings -d '
{
"new_index_type": {
"properties": {
"tags": {
"type": "string",
"index": "not_analyzed"
}
}
}
}'
回答by c-toesca
I had the same problem because I had mappings with same typein the elastic config/mappings
directory.
Removing the mapping file solded my problem.
我遇到了同样的问题,因为我在弹性目录中有相同类型的映射config/mappings
。删除映射文件解决了我的问题。