python - 映射整数在 ElasticSearch 中不起作用
问题描述
我创建了一个索引“活动”并从 csv 中批量处理所有数据。然而,一切都是“文本”类型,一些值应该是“整数”、“长”、“双”类型。我尝试了以下但没有成功。我究竟做错了什么?
es.indices.create(index='activities')
#mapping datatype
es.indices.put_mapping(
index="activities",
include_type_name=True,
doc_type="activity_body",
body={
"activity_body":{
"properties": {"ActivitatID": {"type": "long"},
"Assignaturas": {"type": "text"},
"Competencias": {"type": "text"},
"Descripcion": {"type": "text"},
"EdadMaxima": {"type": "integer"},
"EdadMinima": {"type": "integer"},
"Guardados": {"type": "integer"},
"Idioma": {"type": "text"},
"Link": {"type": "text"},
"Nombre": {"type": "text"},
"Puntuacion": {"type": "double"},
"Tags": { "type": "text"},
"Votos": {"type": "integer"},
"Tipo": {"type": "text"}
}
}
}
)
#open file and load all data to elasticsearch
with open(file_path) as f:
reader = csv.DictReader(f)
helpers.bulk(es, reader, index="activities")
谢谢
解决方案
推荐阅读
- python - 来自 STRING 的 Python Pandas 方括号列表
- javascript - “ionicons/icons”不包含名为“star”的导出
- bash - 将域最小化到特定文件夹
- javascript - 如何在几个控制点之间获得线性插值点?
- javascript - 离开页面后移除 Javascript cookie
- java-8 - ProcessBuilder 不使用 Tika 1.26 和 JDK 1.8 为 Tesseract 4.1 和更高版本创建 tmp 文件
- javascript - 调用 slideUp() 时 div 向左移动
- flutter - 底部溢出 1.9 个像素的 RenderFlex
- php - 如何将 JSON 项添加到 PHP 字符串?
- web - 在局域网上运行的网站是否需要https保护?