dagatsoin
dagatsoin

Reputation: 2656

How to force index on a field?

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?

Upvotes: 0

Views: 390

Answers (1)

dagatsoin
dagatsoin

Reputation: 2656

As stated in the doc nestedtype sub object are not indexed:

So there are two workarounds:

  • For keeping loc as a nested object, add a include_in_parent wildcard to true
  • Or, turn the loc type to Object.

Upvotes: 1

Related Questions