# BoundingBox Query working with GET-Parameter but not with GET Body

**URL:** <https://discuss.elastic.co/t/boundingbox-query-working-with-get-parameter-but-not-with-get-body/14402>\
**Category:** Elasticsearch\
**Created:** [November 14, 2013, 11:16am UTC](https://discuss.elastic.co/t/boundingbox-query-working-with-get-parameter-but-not-with-get-body/14402 "2013-11-14T11:16:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan\_Ramm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jan_ramm/32/1982_2.png) [@Jan\_Ramm](https://discuss.elastic.co/u/Jan_Ramm)\
**Post date:** [November 14, 2013, 11:16am UTC](https://discuss.elastic.co/t/boundingbox-query-working-with-get-parameter-but-not-with-get-body/14402/1 "2013-11-14T11:16:23Z")

</div>

Hi all,

i've got a problem with a BoudingBox Query.  
When i do a search and send the query via get parameter everything works  
fine.  
If i do it via a request body i don't get a hit.

Can you give me a hint what im doing wrong?

# If i do a Boundingbox query with a get body i get no result.

# If i do the same query with a get param i will get the expected result.

# What is my fault?

# Create Index + Mapping

curl -XPOST localhost:9200/testpois5 -d '{  
"settings" : {  
"number\_of\_shards" : 1  
},  
"mappings" : {  
"driver" : {  
"properties" : {  
"location" : { "type" : "geo\_point" }  
}  
}  
}  
}'

# Create one driver

curl -XPUT [http://localhost:9200/testpois5/driver/1](http://localhost:9200/testpois5/driver/1) -d '{"location":{"lat":53, "lon":9}}}'

#do a search request with request Body  
curl -XGET '[http://localhost:9200/testpois5/driver/\_search?pretty=true](http://localhost:9200/testpois5/driver/_search?pretty=true)' -d '{"query":{"match\_all":{}},"filter":{"geo\_bbox":{"location":{"top\_left":[9.935735,53.552467],"bottom\_right":[10.0,52.551963]}}}}'

# Result

# \> {

# "took" : 0,

# "timed\_out" : false,

# "\_shards" : {

# "total" : 1,

# "successful" : 1,

# "failed" : 0

# },

# "hits" : {

# "total" : 0,

# "max\_score" : null,

# "hits" : []

# }

#}

# No Match found? This should match, where is the Problem?

# Do a search request with get param

# URL Decoded [http://localhost:9200/testpois5/driver/\_search?{"query":{"match\_all":{}](http://localhost:9200/testpois5/driver/_search?%7B%22query%22:%7B%22match_all%22:%7B%7D)},"filter":{"geo\_bbox":{"location":{"top\_left":[9.935735,53.552467],"bottom\_right":[10.0,52.551963]}}}}

curl -XGET '[http://localhost:9200/testpois5/driver/\_search?{"query"%3A{"match\_all"%3A{}}%2C"filter"%3A{"geo\_bbox"%3A{"location"%3A{"top\_left"%3A[9.935735%2C53.552467]%2C"bottom\_right"%3A[10.0%2C52.551963]}}}}](http://localhost:9200/testpois5/driver/_search?%7B%22query%22%3A%7B%22match_all%22%3A%7B%7D%7D%2C%22filter%22%3A%7B%22geo_bbox%22%3A%7B%22location%22%3A%7B%22top_left%22%3A%5B9.935735%2C53.552467%5D%2C%22bottom_right%22%3A%5B10.0%2C52.551963%5D%7D%7D%7D%7D)'

# Result:

# {"took":1,"timed\_out":false,"\_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":1,"max\_score":1.0,"hits":[{"\_index":"testpois5","\_type":"driver","\_id":"1","\_score":1.0, "\_source" : {"location":{"lat":53, "lon":9}}}}]}}

# Match found everything works as expected

Link to gist: [https://gist.github.com/janramm87/7464990](https://gist.github.com/janramm87/7464990)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 14, 2013, 2:40pm UTC](https://discuss.elastic.co/t/boundingbox-query-working-with-get-parameter-but-not-with-get-body/14402/2 "2013-11-14T14:40:42Z")

</div>

Hey,

had a quick peek on your sample, my assumption is the following:

- The query itself does not return any hits, because the longitude of the  
POI is outside the bounding box
- The reason why your second query does return something is, that actually  
a match\_all query is executed, because you didnt specify a query. If you  
wanted to specify it, you would have to put the encoded body into the  
source parameter.

The correct call would be curl -XGET '  
[http://localhost:9200/testpois5/driver/\_search?source=ENCODING\_PARTY\_HERE](http://localhost:9200/testpois5/driver/_search?source=ENCODING_PARTY_HERE)...

Hope this helps.

--Alex

On Thu, Nov 14, 2013 at 12:16 PM, Jan Ramm [j.ramm@mytaxi.net](mailto:j.ramm@mytaxi.net) wrote:

> Hi all,
> 
> i've got a problem with a BoudingBox Query.  
> When i do a search and send the query via get parameter everything works  
> fine.  
> If i do it via a request body i don't get a hit.
> 
> Can you give me a hint what im doing wrong?
> 
> # If i do a Boundingbox query with a get body i get no result.
> 
> # If i do the same query with a get param i will get the expected result.
> 
> # What is my fault?
> 
> # Create Index + Mapping
> 
> curl -XPOST localhost:9200/testpois5 -d '{  
> "settings" : {  
> "number\_of\_shards" : 1  
> },  
> "mappings" : {  
> "driver" : {  
> "properties" : {  
> "location" : { "type" : "geo\_point" }  
> }  
> }  
> }  
> }'
> 
> # Create one driver
> 
> curl -XPUT [http://localhost:9200/testpois5/driver/1](http://localhost:9200/testpois5/driver/1) -d '{"location":{"lat":53, "lon":9}}}'
> 
> #do a search request with request Body  
> curl -XGET '[http://localhost:9200/testpois5/driver/\_search?pretty=true](http://localhost:9200/testpois5/driver/_search?pretty=true)' -d '{"query":{"match\_all":{}},"filter":{"geo\_bbox":{"location":{"top\_left":[9.935735,53.552467],"bottom\_right":[10.0,52.551963]}}}}'
> 
> # Result
> 
> # \> {
> 
> # "took" : 0,
> 
> # "timed\_out" : false,
> 
> # "\_shards" : {
> 
> # "total" : 1,
> 
> # "successful" : 1,
> 
> # "failed" : 0
> 
> # },
> 
> # "hits" : {
> 
> # "total" : 0,
> 
> # "max\_score" : null,
> 
> # "hits" :
> 
> # }
> 
> #}
> 
> # No Match found? This should match, where is the Problem?
> 
> # Do a search request with get param
> 
> # URL Decoded [http://localhost:9200/testpois5/driver/\_search?{"query":{"match\_all":{}](http://localhost:9200/testpois5/driver/_search?%7B%22query%22:%7B%22match_all%22:%7B%7D)},"filter":{"geo\_bbox":{"location":{"top\_left":[9.935735,53.552467],"bottom\_right":[10.0,52.551963]}}}}
> 
> curl -XGET '[http://localhost:9200/testpois5/driver/\_search?{"query"%3A{"match\_all"%3A{}}%2C"filter"%3A{"geo\_bbox"%3A{"location"%3A{"top\_left"%3A[9.935735%2C53.552467]%2C"bottom\_right"%3A[10.0%2C52.551963]}}}}](http://localhost:9200/testpois5/driver/_search?%7B%22query%22%3A%7B%22match_all%22%3A%7B%7D%7D%2C%22filter%22%3A%7B%22geo_bbox%22%3A%7B%22location%22%3A%7B%22top_left%22%3A%5B9.935735%2C53.552467%5D%2C%22bottom_right%22%3A%5B10.0%2C52.551963%5D%7D%7D%7D%7D)'
> 
> # Result:
> 
> # {"took":1,"timed\_out":false,"\_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":1,"max\_score":1.0,"hits":[{"\_index":"testpois5","\_type":"driver","\_id":"1","\_score":1.0, "\_source" : {"location":{"lat":53, "lon":9}}}}]}}
> 
> # Match found everything works as expected
> 
> Link to gist: [gist:7464990 · GitHub](https://gist.github.com/janramm87/7464990)
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 2:07am UTC](https://discuss.elastic.co/t/boundingbox-query-working-with-get-parameter-but-not-with-get-body/14402/3 "2017-07-06T02:07:00Z")

</div>

Closed on July 6, 2017, 2:07am UTC


