Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql ElasticSearch PutMapping API:MapperParsingException根类型映射解析后不为空_Mysql_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch,Mysql,elasticsearch" /> elasticsearch,Mysql,elasticsearch" />

Mysql ElasticSearch PutMapping API:MapperParsingException根类型映射解析后不为空

Mysql ElasticSearch PutMapping API:MapperParsingException根类型映射解析后不为空,mysql,elasticsearch,Mysql,elasticsearch,我的本地ES1.3.4实例和MySql 1.3.4.4的JDBC实例上有一条河 这条河运行良好,正在ES中导入数据。我面临的问题是,我的一个字段是文本字段,其中有空格。例如“实时计算器”。ES将其索引为“实时”、“实时”和“计算器”,而不是“实时计算器” 因此,我使用下面提到的JSON创建映射: { "sale_test": { "properties": { "Client": { "index": "not_an

我的本地ES1.3.4实例和MySql 1.3.4.4的JDBC实例上有一条河

这条河运行良好,正在ES中导入数据。我面临的问题是,我的一个字段是文本字段,其中有空格。例如“实时计算器”。ES将其索引为“实时”、“实时”和“计算器”,而不是“实时计算器”

因此,我使用下面提到的JSON创建映射:

{
    "sale_test": {
        "properties": {
            "Client": {
                "index": "not_analyzed",
                "type": "string"
            },
            "OfferRGU": {
                "type": "long"
            },
            "SaleDate": {
                "format": "dateOptionalTime",
                "type": "date"
            },
            "State": {
                "type": "string"
            }
        }
    }
}
指挥部:

curl -XPUT http://localhost:9200/my_index/_mapping/my_type
但我得到了下面提到的错误:

> {"error":"MapperParsingException[Root type mapping not empty after
> parsing! Remaining fields:   [sale_test :
> {properties={Client={type=string, index=not_analyzed},
> OfferRGU={type=long}, SaleDate={type=date, format=dateOptionalTime},
> State={type=string}}}]]","status":400}
当我尝试使用下面提到的命令查看当前映射时:

curl -XGET http://localhost:9200/dgses/sale_test_river/_mapping
我只得到这个:{}


谢谢您的帮助。

您的类型不一致,在API调用中,类型是my\u type

curl -XPUT http://localhost:9200/my_index/_mapping/my_type
然后在JSON消息中变成sale\u test

具有一致的类型将解决您的问题:

curl -XPUT http://localhost:9200/my_index/_mapping/sale_test -d '
    { 
     "sale_test": { 
       "properties": { 
         "Client": {"type": "string", "index": "not_analyzed" }, 
         "OfferRGU": { "type": "long" }, 
         "SaleDate": { "type": "date", "format": "dateOptionalTime" },
         "State": { "type": "string" }
         } 
       } 
    }'

这里有一个新索引和一个新类型:

更正索引和类型会使我:

curl -XGET http://localhost:9200/my_index/sale_test/_mapping?pretty
{
  "myindex" : {
    "mappings" : {
      "sale_test" : {
        "properties" : {
          "Client" : {
            "type" : "string",
            "index" : "not_analyzed"
          },
          "OfferRGU" : {
            "type" : "long"
          },
          "SaleDate" : {
            "type" : "date",
            "format" : "dateOptionalTime"
          },
          "State" : {
            "type" : "string"
          }
        }
      }
    }
  }
}

谢谢这是打字问题。我得到了映射,在阅读了弹性搜索文档后,我意识到我们不能为已经创建的索引更新映射。我们需要先删除以前的映射,然后为此索引创建新映射。如果还有其他方法,请分享。谢谢
curl -XGET http://localhost:9200/my_index/sale_test/_mapping?pretty
{
  "myindex" : {
    "mappings" : {
      "sale_test" : {
        "properties" : {
          "Client" : {
            "type" : "string",
            "index" : "not_analyzed"
          },
          "OfferRGU" : {
            "type" : "long"
          },
          "SaleDate" : {
            "type" : "date",
            "format" : "dateOptionalTime"
          },
          "State" : {
            "type" : "string"
          }
        }
      }
    }
  }
}