elasticsearch - 当我有弹性搜索索引异常时,我可以指定详细信息字段吗?
问题描述
当我尝试索引 elasticsearch 时收到错误消息:得到响应{'took': 1, 'errors': True, 'items': [{'index': {'_index': 'mapstore-development-products', '_type': 'product', '_id': '776896', 'status': 400, 'error': {'type': 'mapper_parsing_exception', 'reason': 'failed to parse', 'caused_by': {'type': 'number_format_exception', 'reason': 'empty String'}}}}]}
有什么方法可以让我从这个返回结果中知道哪些特定字段是空的?
解决方案
此问题是由于 (1) 在发布第一条记录之前未创建索引映射 (2) 您的第一条记录有一个空字段(字符串),稍后您希望它是数字。
如果您没有提前指定映射,Elasticsearch 会为您的字段动态分配类型。我认为您不应该找到特定的空字符串字段。相反,您应该在发布第一条记录之前为您的索引创建映射,以便解决此问题。对于您的情况,您可能需要创建一个具有正确映射的新索引,然后重新索引。
看到这个:
推荐阅读
- node.js - 在节点应用程序中为 ALB 启用运行状况检查的代码
- linux - 在linux中更改子网掩码
- android - 如何在 ListView 的字符串数组中显示 HTML 文本
- arrays - Angular 8 为什么承诺返回一个未定义的值,尽管它在解决之前得到了适当的安慰?
- schema.org - Schema.org - 嵌套事件
- python - 找出两个字典是否导致循环
- sql-server - SQL 错误 超出最大存储过程、函数、触发器或视图嵌套级别
- css - 滚动条不适用于父级的最大高度
- python - 如何使用谷歌colab中的python Open CV从文件夹中检索图像以测试模型的性能并将所有图像打印到csv文件中
- php - 不使用 group by、distinct 或使用 php 计数的 mysql 查询计数