📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 6.8-7.1

简而言之,当 Elasticsearch 尝试在未映射为 geo_point 的字段上执行基于地理位置的操作时,会出现此错误。Elasticsearch 要求用于地理操作的字段必须映射为 geo_point 类型。要解决此问题,您可以使用正确的映射重新索引数据,或者使用"PUT mapping" API 将字段的映射更新为 geo_point。但是请注意,更新映射只会影响新数据,而不会影响现有数据。

日志上下文

日志 “referenced field must be mapped to geo_point” 的类名是 GeoContextMapping.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

    @Override
    public SetparseContext(ParseContext parseContext; XContentParser parser) throws IOException; ElasticsearchParseException {
        if (fieldName != null) {
            MappedFieldType fieldType = parseContext.mapperService().fieldType(fieldName);
            if (!(fieldType instanceof GeoPointFieldMapper.GeoPointFieldType)) {
                throw new ElasticsearchParseException("referenced field must be mapped to geo_point");
            }
        }
        final Setcontexts = new HashSet<>();
        Token token = parser.currentToken();
        if (token == Token.START_ARRAY) {
查看 Markdown
On this page