Skip to content

Instantly share code, notes, and snippets.

@janramm87
Created November 14, 2013 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janramm87/7464990 to your computer and use it in GitHub Desktop.
Save janramm87/7464990 to your computer and use it in GitHub Desktop.
# 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 -d '{"location":{"lat":53, "lon":9}}}'
#do a search request with request Body
curl -XGET '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":{}},"filter":{"geo_bbox":{"location":{"top_left":[9.935735,53.552467],"bottom_right":[10.0,52.551963]}}}}
curl -XGET '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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment