# Help need with geo\_poligon query

**URL:** https://discuss.elastic.co/t/help-need-with-geo-poligon-query/223440
**Category:** Elasticsearch
**Created:** [March 13, 2020, 3:52am UTC](https://discuss.elastic.co/t/help-need-with-geo-poligon-query/223440 "2020-03-13T03:52:54Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![vadim-shadrin](https://avatars.discourse-cdn.com/v4/letter/v/dc4da7/32.png) [@vadim-shadrin](https://discuss.elastic.co/u/vadim-shadrin)
#### Post date: [March 13, 2020, 3:52am UTC](https://discuss.elastic.co/t/help-need-with-geo-poligon-query/223440/1 "2020-03-13T03:52:54Z")

</div>

My index mapping is

{  
"events" : {  
"mappings" : {  
"properties" : {  
"accepted" : {  
"type" : "nested"  
},  
"address" : {  
"type" : "text"  
},  
"available\_for" : {  
"properties" : {  
"key" : {  
"type" : "long"  
},  
"value" : {  
"type" : "text",  
"fields" : {  
"keyword" : {  
"type" : "keyword",  
"ignore\_above" : 256  
}  
}  
}  
}  
},  
"avatar\_image" : {  
"type" : "text"  
},  
"background\_image" : {  
"type" : "text"  
},  
"budget" : {  
"properties" : {  
"amount" : {  
"type" : "long"  
},  
"currency" : {  
"type" : "text",  
"fields" : {  
"keyword" : {  
"type" : "keyword",  
"ignore\_above" : 256  
}  
}  
}  
}  
},  
"creator" : {  
"properties" : {  
"age" : {  
"type" : "long"  
},  
"avatar" : {  
"type" : "text",  
"fields" : {  
"keyword" : {  
"type" : "keyword",  
"ignore\_above" : 256  
}  
}  
},  
"id" : {  
"type" : "text",  
"fields" : {  
"keyword" : {  
"type" : "keyword",  
"ignore\_above" : 256  
}  
}  
},  
"name" : {  
"type" : "text",  
"fields" : {  
"keyword" : {  
"type" : "keyword",  
"ignore\_above" : 256  
}  
}  
},  
"sex" : {  
"type" : "long"  
},  
"vip" : {  
"type" : "long"  
}  
}  
},  
"description" : {  
"type" : "text"  
},  
"event\_date" : {  
"type" : "integer"  
},  
"invited" : {  
"type" : "nested"  
},  
"is\_checking" : {  
"type" : "integer"  
},  
"location" : {  
"type" : "geo\_point"  
},  
"max\_bid" : {  
"type" : "integer"  
},  
"min\_bid" : {  
"type" : "integer"  
},  
"people\_amount" : {  
"properties" : {  
"key" : {  
"type" : "long"  
},  
"value" : {  
"type" : "text",  
"fields" : {  
"keyword" : {  
"type" : "keyword",  
"ignore\_above" : 256  
}  
}  
}  
}  
},  
"status" : {  
"type" : "integer"  
},  
"titles" : {  
"type" : "object"  
},  
"who\_pay" : {  
"properties" : {  
"key" : {  
"type" : "long"  
},  
"value" : {  
"type" : "text",  
"fields" : {  
"keyword" : {  
"type" : "keyword",  
"ignore\_above" : 256  
}  
}  
}  
}  
}  
}  
}  
}  
}

I created 3 documents in index with location of distance more then 500 meters from my position

There is polygon on my query below with radius 100 meters around my position

GET /events/\_search

{  
"query": {  
"bool" : {  
"must" : {  
"match\_all" : {}  
},  
"filter" : {  
"geo\_polygon" : {  
"location": {  
"points" : [  
{  
"lat": 56.010451,  
"lon": 92.814699  
},  
{  
"lat": 56.010331,  
"lon": 92.815503  
},  
{  
"lat": 56.010002,  
"lon": 92.816092  
},  
{  
"lat": 56.009552,  
"lon": 92.816307  
},  
{  
"lat": 56.009102,  
"lon": 92.816092  
},  
{  
"lat": 56.008773,  
"lon": 92.815503  
},  
{  
"lat": 56.008653,  
"lon": 92.814699  
},  
{  
"lat": 56.008773,  
"lon": 92.813895  
},  
{  
"lat": 56.009102,  
"lon": 92.813306  
},  
{  
"lat": 56.009552,  
"lon": 92.813091  
},  
{  
"lat": 56.010002,  
"lon": 92.813306  
},  
{  
"lat": 56.010331,  
"lon": 92.813895  
}  
]  
}  
}  
}  
}  
}  
}

But I got the result with all the documents, despite the fact that points do not placed inside of radius of search.

Elasticesearch-7.5

---

<div class="post-metadata">

### Author: ![Ignacio\_Vera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ignacio_vera/32/36674_2.png) [@Ignacio\_Vera](https://discuss.elastic.co/u/Ignacio_Vera)
#### Post date: [March 13, 2020, 9:50am UTC](https://discuss.elastic.co/t/help-need-with-geo-poligon-query/223440/2 "2020-03-13T09:50:38Z")

</div>

Could you provide an example of a point that does not meet your expectations?

---

<div class="post-metadata">

### Author: ![vadim-shadrin](https://avatars.discourse-cdn.com/v4/letter/v/dc4da7/32.png) [@vadim-shadrin](https://discuss.elastic.co/u/vadim-shadrin)
#### Post date: [March 13, 2020, 11:44am UTC](https://discuss.elastic.co/t/help-need-with-geo-poligon-query/223440/3 "2020-03-13T11:44:37Z")

</div>

Could you look on my data here ?

[http://kibana.u05.ru/app/kibana#/dev\_tools/console?\_g=()](http://kibana.u05.ru/app/kibana#/dev_tools/console?_g=())

You can create polygon with difference radius here

[http://geo.u05.ru/v1/geo/poligon/56.009552/92.814699/100](http://geo.u05.ru/v1/geo/poligon/56.009552/92.814699/100)

I described my problem in this topic

> [@Help need with geo\_poligon query](https://discuss.elastic.co/t/help-need-with-geo-poligon-query/223440):
>
> My index mapping is { "events" : { "mappings" : { "properties" : { "accepted" : { "type" : "nested" }, "address" : { "type" : "text" }, "available\_for" : { "properties" : { "key" : { "type" : "long" }, "value" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore\_above" : 256 } } } } }, "avatar\_image" : { "type" : "text" }, "background\_image" : { "type" : "text" }, "budget" : { "properties" : { "amount" : { "type" : "long" }, "currency"…

Thank you !

---

<div class="post-metadata">

### Author: ![vadim-shadrin](https://avatars.discourse-cdn.com/v4/letter/v/dc4da7/32.png) [@vadim-shadrin](https://discuss.elastic.co/u/vadim-shadrin)
#### Post date: [March 13, 2020, 11:57am UTC](https://discuss.elastic.co/t/help-need-with-geo-poligon-query/223440/4 "2020-03-13T11:57:06Z")

</div>

80.211.180.190 → [kibana.u05.ru](http://kibana.u05.ru) , [geo.u05.ru](http://geo.u05.ru)

In case if DNS records are still not updated

---

<div class="post-metadata">

### Author: ![Ignacio\_Vera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ignacio_vera/32/36674_2.png) [@Ignacio\_Vera](https://discuss.elastic.co/u/Ignacio_Vera)
#### Post date: [March 13, 2020, 12:04pm UTC](https://discuss.elastic.co/t/help-need-with-geo-poligon-query/223440/5 "2020-03-13T12:04:30Z")

</div>

I think your problem is that there is a space between your GET and the query so effectively you are not executing the query.

```auto

GET /events/_search
<---- Try removing this space
{
"query": {
"bool" : {

```

---

<div class="post-metadata">

### Author: ![vadim-shadrin](https://avatars.discourse-cdn.com/v4/letter/v/dc4da7/32.png) [@vadim-shadrin](https://discuss.elastic.co/u/vadim-shadrin)
#### Post date: [March 17, 2020, 4:30am UTC](https://discuss.elastic.co/t/help-need-with-geo-poligon-query/223440/6 "2020-03-17T04:30:09Z")

</div>

Thank you. it works.

---

<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, 2020, 4:30am UTC](https://discuss.elastic.co/t/help-need-with-geo-poligon-query/223440/7 "2020-04-14T04:30:12Z")

</div>

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