gpt4 book ai didi

geo_point 与 null_value 的 Elasticsearch 映射

转载 作者:行者123 更新时间:2023-12-02 22:25:36 24 4
gpt4 key购买 nike

我遇到了一个与 elasticsearch 相关的问题 geo_point 从数据库导入时。
如果 的值,我的映射效果很好龙 纬度 字段包含实际值。

现在可能发生某些行包含 空值 经纬度如果我尝试导入这些,我会得到一个 ElasticsearchParseException[纬度必须是数字] 错误似乎完全合法。

所以我想将这些字段设置为 0,0 或 NULL,NULL 但这是我卡住的地方。

我尝试添加 'null_value' => '0' 到映射,但这似乎不起作用。

这是映射的样子:

'_source' => array(
'enabled' => true
),
'properties' => array(
'coordinates' => array(
'type' => 'geo_point',
'null_value' => '0'
)
)

任何人都知道这一点?

(我正在使用 PHP Elasticsearch 客户端。)

最佳答案

FWIW 这是您的文档结构的问题,而不是空值的存在。

如果您有一个字段 coordinates具有映射类型 geo_point ,您必须使用 {..., coordinates: null} 插入您的文档而不是 {..., coordinates: {lat: null, lon: null}}或类似 equivalent formats .必须缺少整个字段,而不是其内部数据。

关于geo_point 与 null_value 的 Elasticsearch 映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23756384/

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