【问题标题】:How to force index on a field?如何在字段上强制索引?
【发布时间】:2015-07-30 20:17:26
【问题描述】:

我已经索引了一些包含 GEOJson 点对象的条目:

示例:

  {
      "_id": "48LEDd5imvEpFnCQx",
      "loc": {
          "type": "Point",
          "coordinates": [-2.7577078342437744, 47.65381454210301]
      },
      "geoip": false,
      "trackerId": "RG-DEMO-1",
      "date": "2015-07-25T21:12:07.286Z"
  }

映射:

        {
        'trace': {
            'properties': {
                'loc': {
                    'type': 'nested',
                    'properties': {
                        'type': {
                            'type': 'string'
                        },
                        'coordinates':{
                            'type': 'geo_point',
                            'geohash':true,
                            'geohash_prefix':true,
                            'lat_lon':true,
                            'fielddata' : {
                                'format' : 'compressed',
                                'precision' : '1cm'
                            }
                        }
                    }
        ...

geohash 已生成,但 Kibana 说 loc.coordinates 未编入索引,我无法使用可视化地图 Unindexed fields can not be searched

在这种类型的字段上强制索引的技巧是什么?

【问题讨论】:

  • 对我有用吗?检查 curl -XPOST /_search" -d' { "sort": [ { "loc.coordinates.geohash" : {"order" : "desc"} } ] }' 你应该能够查看geohash值
  • 没错!您的查询向我展示了 geohash。但是为什么我无法通过 Kibana 访问? (我现在正在打电话。我会尽快重写问题)

标签: elasticsearch kibana


【解决方案1】:

the docnestedtype 中所述,子对象未编入索引:

所以有两种解决方法:

  • 要将loc 保留为嵌套对象,请将include_in_parent 通配符添加到true
  • 或者,将loc 类型转换为Object

【讨论】:

    猜你喜欢
    • 2018-05-23
    • 2020-07-20
    • 2011-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-05
    • 2019-05-12
    • 1970-01-01
    相关资源
    最近更新 更多