ElasticSearch 7 和 Kibana 意外行为
ElasticSearch 7 & Kibana unexpected behavior
我正在尝试将数据存储到弹性搜索索引中,列的数据如下所示
C ID
1234
5678
NA
123D D5614 A7890
现在我知道这个数据有点复杂,所以我为此选择了具有以下属性的文本字段
"mappings": {
"properties":{
"C ID":{"type":"text" , "fields" :{'keyword': {'type':'keyword'}}},
}
}
即使在这之后我总是收到错误。
无法解析文档 id 4 中 long 类型的字段[C ID]
请帮我解决这个问题。我没有给出长期的任何参考,不知道为什么会出现此错误
更新
我的代码库
from elasticsearch import Elasticsearrch
ESConnector class 负责 kerberos 登录。我们在 ESConnector class
下调用 Elasticsearch
es = ESConnector()
if not ex.indices.exist(INDEX):
set = {"settings":{"index":{"number_of_shards":1, "number_of_replicas":1}}
es.indices.create(INDEX, body = set)
mbody = {
"mappings": {
"properties":{
"C ID":{"type":"text" , "fields" :{'keyword': {'type':'keyword'}}},
}
}
}
es.indices.put_mapping(INDEX, body = mbody)
您可以在一次调用中使用映射创建索引
if not es.indices.exist(INDEX):
body = {
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 1
}
},
"mappings": {
"properties": {
"C ID": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
}
es.indices.create(INDEX, body = body)
应该是这样的。
我正在尝试将数据存储到弹性搜索索引中,列的数据如下所示
C ID
1234
5678
NA
123D D5614 A7890
现在我知道这个数据有点复杂,所以我为此选择了具有以下属性的文本字段
"mappings": {
"properties":{
"C ID":{"type":"text" , "fields" :{'keyword': {'type':'keyword'}}},
}
}
即使在这之后我总是收到错误。 无法解析文档 id 4 中 long 类型的字段[C ID]
请帮我解决这个问题。我没有给出长期的任何参考,不知道为什么会出现此错误
更新
我的代码库
from elasticsearch import Elasticsearrch
ESConnector class 负责 kerberos 登录。我们在 ESConnector class
下调用 Elasticsearches = ESConnector()
if not ex.indices.exist(INDEX):
set = {"settings":{"index":{"number_of_shards":1, "number_of_replicas":1}}
es.indices.create(INDEX, body = set)
mbody = {
"mappings": {
"properties":{
"C ID":{"type":"text" , "fields" :{'keyword': {'type':'keyword'}}},
}
}
}
es.indices.put_mapping(INDEX, body = mbody)
您可以在一次调用中使用映射创建索引
if not es.indices.exist(INDEX):
body = {
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 1
}
},
"mappings": {
"properties": {
"C ID": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
}
es.indices.create(INDEX, body = body)
应该是这样的。