Q:有两个人掉到陷阱里了,死的人叫死人,活人叫什么?

定义好mapping后数据无法入库

Elasticsearch | 作者 xiaoshancun | 发布于2020年03月02日 | 阅读数:2123

 ES: 7.1 
问题现象:  不指定index mapping时数据可以入库,但有些数据类型没有正确识别出来,需要转换,所以就手工定义了mapping,定义时没有报错,使用 logstash 重新写入数据,发现es中无数据,一条都没有  请问这是怎么回事,该如何排查,感谢!!!
 
{
  "china2020" : { //系统自动生成的mapping
    "mappings" : {
      "date_detection" : false,
      "numeric_detection" : true,
      "properties" : {
        "@timestamp" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "@version" : {
          "type" : "long"
        },
        "auth" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "host" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "timestamp" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "当日新增" : {
          "type" : "long"
        },
        "日期" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "省份" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "累计" : {
          "type" : "long"
        },
        "颜色" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        }
      }
    }
  }
}
#手工定义的 mappin不能用
{
"china2020" : {
"mappings" : {
"date_detection" : true,
"numeric_detection" : true,
"properties" : {
"@timestamp" : {
"type" : "date"
},
"@version" : {
"type" : "long"
},
"auth" : {
"type" : "keyword",
"ignore_above" : 256
},
"host" : {
"type" : "keyword",
"ignore_above" : 256
},
"timestamp" : {
"type" : "date"
},
"当日新增" : {
"type" : "long"
},
"日期" : {
"type" : "date"
},
"省份" : {
"type" : "keyword",
"ignore_above" : 256
},
"累计" : {
"type" : "long"
},
"颜色" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
已邀请:

liuxg - Elastic

赞同来自:

请问一下你的logstash的输入是不是从Filebeat里来的啊?如果是的话,有一种可能是Filebeat已经处理完你的log文件,那么它不会再处理这个文件了,因为在它的data/registry里有记录最后处理的文件的位置。 如果需要重新处理这个文件,需要删除在Filebeat下的data/registry目录。

要回复问题请先登录注册