gpt4 book ai didi

elasticsearch - 无法创建Elasticsearch映射或使日期字段起作用

转载 作者:行者123 更新时间:2023-12-03 02:20:07 24 4
gpt4 key购买 nike

{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
}
"status" : 400
我已经读过上面的内容是因为类型在Elasticsearch 7.7中已弃用,对数据类型有效吗?我的意思是我该怎么说我希望将数据视为日期?
我当前的映射具有以下元素:
"Time": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
我只是想使用类型:“date”再次创建它,但是我注意到甚至复制粘贴当前映射(也可以)也会产生错误... https://github.com/jayzeng/scrapy-elasticsearch自动生成了我的索引和mappins
我的目标仅仅是有一个日期字段,我所有的日期都在索引中,但是当我想在kibana中进行过滤时,我可以看到它不被视为日期字段。而且,modyfing映射似乎不是一种选择。
明显的ELK新手在这里,请裸露我(:
enter image description here
该错误具有讽刺意味,因为我从现有索引/映射中粘贴了映射。
enter image description here

最佳答案

您正在经历此问题,因为关于命名文档类型的change in 7.0中断了。
长话短说,而不是

PUT example_index
{
"mappings": {
"_doc_type": {
"properties": {
"Time": {
"type": "date",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
}
}
你应该做
PUT example_index
{
"mappings": { <-- Note no top-level doc type definition
"properties": {
"Time": {
"type": "date",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
}
我不熟悉您的抓包,但乍一看似乎只是本地py ES客户端的包装,应将您的映射定义转发到ES。

注意:如果您将字段定义为 text,并且打算将其更改为 date(或添加类型为 fielddate),则会出现以下错误:
mapper [Time] of different type, current_type [text], merged_type [date]
您基本上有两个选择:
  • 删除索引,设置新的映射并为所有内容重新索引(最简单,但会导致停机)
  • 使用新字段扩展映射,我们将其称为Time_as_datetime并使用 script (引入了全新的字段/属性-有点冗长)来更新您现有的文档
  • 关于elasticsearch - 无法创建Elasticsearch映射或使日期字段起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62625671/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com