# How to import GeoJSON into elastic search and Filter using a polygon

**URL:** <https://discuss.elastic.co/t/how-to-import-geojson-into-elastic-search-and-filter-using-a-polygon/249752>\
**Category:** Elasticsearch\
**Created:** [September 24, 2020, 7:21am UTC](https://discuss.elastic.co/t/how-to-import-geojson-into-elastic-search-and-filter-using-a-polygon/249752 "2020-09-24T07:21:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Surag\_MT](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/surag_mt/32/76069_2.png) [@Surag\_MT](https://discuss.elastic.co/u/Surag_MT)\
**Post date:** [September 24, 2020, 7:21am UTC](https://discuss.elastic.co/t/how-to-import-geojson-into-elastic-search-and-filter-using-a-polygon/249752/1 "2020-09-24T07:21:34Z")

</div>

I want to import a collection of linestrings from GeoJSON into elastic search. The number of features that I want to import will be in the range of millions.

I am planning to show these features using Mapbox GL by querying features inside the current map bound at a time instead of loading all features into the map initially.

When map bound changes, I will trigger another search query using the new map bound. How can I do this? I have tried something as in this link  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-shape-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-shape-query.html).

But it is not working as expected. Features returned are not inside the bound that i have requested. I am totally new to elastic search. Can someone help me on this

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [September 24, 2020, 5:13pm UTC](https://discuss.elastic.co/t/how-to-import-geojson-into-elastic-search-and-filter-using-a-polygon/249752/2 "2020-09-24T17:13:58Z")

</div>

Hi @Surag_MT,

Can you share the query you are running?

With linestrings you would probably need to use a [geo-shape query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-query.html) since [geo-bounding box queries only work on points](https://github.com/elastic/elasticsearch/issues/54628).

---

<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:** [October 22, 2020, 5:14pm UTC](https://discuss.elastic.co/t/how-to-import-geojson-into-elastic-search-and-filter-using-a-polygon/249752/3 "2020-10-22T17:14:01Z")

</div>

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