Help need with geo_poligon query

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

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

Could you look on my data here ?

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

I described my problem in this topic

Thank you !

80.211.180.190 → kibana.u05.ru , geo.u05.ru

In case if DNS records are still not updated

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


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

Thank you. it works.

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