# Field bbox is not a geo\_point field

**URL:** <https://discuss.elastic.co/t/field-bbox-is-not-a-geo-point-field/79018>\
**Category:** Elasticsearch\
**Created:** [March 17, 2017, 12:11pm UTC](https://discuss.elastic.co/t/field-bbox-is-not-a-geo-point-field/79018 "2017-03-17T12:11:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![daviddd](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@daviddd](https://discuss.elastic.co/u/daviddd)\
**Post date:** [March 17, 2017, 12:11pm UTC](https://discuss.elastic.co/t/field-bbox-is-not-a-geo-point-field/79018/1 "2017-03-17T12:11:29Z")

</div>

Dear All,

I'm using: Elasticsearch version: 5.2

My index mapping contains:  
`'bbox': {'type': 'geo_shape', 'precision': '10km', 'tree': 'quadtree', },`

A Python script inserts in Elastic the area\_of\_interest object fields, and the bbox insertion is:

```
    if area_of_interest.bbox_minx is not None:
        doc['bbox'] = {
            "type": "envelope",
            "coordinates": [[obj.bbox_minx, obj.bbox_maxy], [obj.bbox_maxx, obj.bbox_miny]],
        }
    else:
        doc['bbox'] = None

```

Of course all bbox fields (bbox\_minx, bbox\_maxy, bbox\_maxx, bbox\_miny) are evaluated or None (null in Elastic is inserted).

The insertion works:

```
# station with bbox evaluated
{
	"_index": "place-20170317-054435",
	"_type": "placelayer",
	"_id": "1962",
	"_version": 1,
	"found": true,
	"_source": {
	"id": 1962,
	"lang": "id",
	"bbox": {
		"type": "envelope",
		"coordinates": [[-119.6928, 34.4031], [-119.6928,34.4031]]
	},
	"modified": "2017-03-15T15:05:06.678083+00:00",
	"created": "2017-03-15T15:05:06.677892+00:00",
	"name": "station test 33333",
	"description": "desc station 33333",
	}
}

# station with bbox to null
{
	"_index": "place-20170317-054435",
	"_type": "placelayer",
	"_id": "2390",
	"_version": 1,
	"found": true,
	"_source": {
		"id": 2390,
		"lang": "",
		"bbox": null,
		"modified": "2017-03-17T04:57:27.781646+00:00",
		"created": "2017-03-17T04:57:27.519688+00:00",
		"name": "station test 19383",
		"description": "desc station 19383",
	}
}

```

While querying I got this EXCEPTION:

```
GET /places/placelayer/_search
{
    "query": {
        "bool" : {
            "must" : {
                "match_all" : {}
            },
            "filter" : {
                "geo_bounding_box" : {
                    "bbox" : {
                        "top_left" : {
                            "lat" : 40.73,
                            "lon" : -74.1
                        },
                        "bottom_right" : {
                            "lat" : 40.01,
                            "lon" : -71.12
                        }
                    }
                }
            }
        }
    }
}

raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, 'search_phase_execution_exception', 'field [bbox] is not a geo_point field')

```

My field called bbox is a 'type': 'geo\_shape', and sincerely I don't understand the reason for the exception.

Thanks,

D

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 17, 2017, 12:57pm UTC](https://discuss.elastic.co/t/field-bbox-is-not-a-geo-point-field/79018/2 "2017-03-17T12:57:23Z")

</div>

Here: [Geo Bounding Box Query | Elasticsearch Guide [5.2] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-geo-bounding-box-query.html#_geo_point_type)

> The filter requires the `geo_point` type to be set on the relevant field.

In your case it's a `geo_shape`

---

<div class="post-metadata">

**Author:** ![daviddd](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@daviddd](https://discuss.elastic.co/u/daviddd)\
**Post date:** [March 17, 2017, 1:27pm UTC](https://discuss.elastic.co/t/field-bbox-is-not-a-geo-point-field/79018/3 "2017-03-17T13:27:53Z")

</div>

Davide, thanks a lot for replying!

Based on this comment  
[https://github.com/elastic/elasticsearch-dsl-py/issues/427](https://github.com/elastic/elasticsearch-dsl-py/issues/427) I was wrongly  
doing

GET /places/placelayer/\_search  
{  
"query": {  
"bool" : {  
"must" : {  
"match\_all" : {}  
},  
"filter" : {  
"geo\_bounding\_box" : {

```
                "bbox" : {
                    "top_left" : {
                        "lat" : 40.73,
                        "lon" : -74.1
                    },
                    "bottom_right" : {
                        "lat" : 40.01,
                        "lon" : -71.12
                    }
                }
            }

        }
    }
}

```

}

But it doesn't work:

```
    "type": "query_shard_exception",
    "reason": "field [bbox] is not a geo_point field",

```

While it works using:

GET /places/placelayer/\_search  
{  
"query": {  
"geo\_shape": {  
"bbox": {  
"shape": {  
"type": "envelope",  
"coordinates": [[0, 50],[2, 40]]  
}  
}  
}  
}  
}

Or using elasticsearch-dsl-py:

(  
# bbox\_minx:{0}, bbox\_miny:{1}, bbox\_maxx:{2}, bbox\_maxy:{3}  
bbox\_param = bbox\_param.split(',')  
if len(bbox\_param) != 4:  
raise ValidationError(\_('Invalid bounding box.'))

```
    d = {
        'shape': {
            'type': 'envelope',
            'coordinates': [[bbox_param[0], bbox_param[1]],

```

[bbox\_param[2], bbox\_param[3]]]  
}  
}  
queryset = queryset.filter('geo\_shape', bbox=d)

)

D

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 14, 2017, 1:27pm UTC](https://discuss.elastic.co/t/field-bbox-is-not-a-geo-point-field/79018/4 "2017-04-14T13:27:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
