# Is CONTAINS deprecated in 7.x?

**URL:** <https://discuss.elastic.co/t/is-contains-deprecated-in-7-x/180001>\
**Category:** Elasticsearch\
**Created:** [May 7, 2019, 2:13pm UTC](https://discuss.elastic.co/t/is-contains-deprecated-in-7-x/180001 "2019-05-07T14:13:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tstirrat](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@tstirrat](https://discuss.elastic.co/u/tstirrat)\
**Post date:** [May 7, 2019, 2:13pm UTC](https://discuss.elastic.co/t/is-contains-deprecated-in-7-x/180001/1 "2019-05-07T14:13:33Z")

</div>

I found [documentation here](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/query-dsl-geo-shape-query.html#_spatial_relations) that still references CONTAINS, but also includes a deprecation notice.

The following doctype declaration works:

```auto
                    "bounding_box": {
                        "type": "geo_shape",
                        "precision": '1km'
                    },

```

But if I remove "precision", tests start failing because

```auto
	RequestError(400, 'search_phase_execution_exception', 'CONTAINS query relation not supported for Field [bounding_box]')

```

I'm actually on 6.6 currently, but there's a good chunk of functionality that depends on CONTAINS, or at least something that functions like CONTAINS. Are there workarounds for this?

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [May 10, 2019, 3:46pm UTC](https://discuss.elastic.co/t/is-contains-deprecated-in-7-x/180001/2 "2019-05-10T15:46:07Z")

</div>

It's not deprecated, more like a temporary regression of functionality. We added new BKD-backed geoshapes in 6.6 which come with a ton of benefits (faster indexing, better precision, better memory overhead), but they don't support`CONTAINS` queries yet. We decided to release support for BKD geoshapes anyway, despite missing some functionality, so that people could start indexing into the new shapes and get the other benefits

There's a PR up to [add support in Lucene](https://issues.apache.org/jira/browse/LUCENE-8620), and an [Elasticsearch issue](https://github.com/elastic/elasticsearch/issues/41204) tracking that progress. The Lucene PR is moving along nicely, so we hope to get it added back soon.

Today, that means there are two options: move to the new BKD geoshapes and just avoid `CONTAINS` queries until it is added back, or stay with the old prefix-tree geoshapes and then upgrade to BKD when `CONTAINS` support lands.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![tstirrat](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@tstirrat](https://discuss.elastic.co/u/tstirrat)\
**Post date:** [May 10, 2019, 4:36pm UTC](https://discuss.elastic.co/t/is-contains-deprecated-in-7-x/180001/3 "2019-05-10T16:36:37Z")

</div>

Gotcha. Thank you for the clarification! I'll keep an eye out for that release.

---

<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:** [June 7, 2019, 4:36pm UTC](https://discuss.elastic.co/t/is-contains-deprecated-in-7-x/180001/4 "2019-06-07T16:36:41Z")

</div>

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