How to force index on a field?

时间:2015-07-28 17:06:14

标签: elasticsearch kibana

I have indexed some entries containing a GEOJson point object :

exemple :

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

The mapping:

        {
        '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'
                            }
                        }
                    }
        ...

The geohash is generated but Kibana says that loc.coordinates is not indexed and I can't use the visualisation map Unindexed fields can not be searched

What is the trick to force index on this type of field?

1 个答案:

答案 0 :(得分:1)

the doc nested中所述,类型子对象未编入索引:

所以有两种解决方法:

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