I'm getting issues with the GeoDistanceFilterBuilder. Below is the Java API
code that create a GeoDistanceFilterBuilder.
fb = new
GeoDistanceFilterBuilder("X.location").lon(Double.valueOf(longitude)).lat(Double.valueOf(lattitude)).distance(Double.valueOf(distance),
DistanceUnit.MILES);
and this filter is appended to a match all query to finally get the below
query.
{
"from" : 0,
"size" : 10,
"query" : {
"bool" : {
"must" : {
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"geo_distance" : {
"X.location" : [ 44.824971, -93.316218 ],
"distance" : "15.0mi"
}
}
}
}
}
}
}
However this does work but if i replace the Square brackets around the
long/lat to quotes it does.Below is the working query.
{
"from" : 0,
"size" : 10,
"query" : {
"bool" : {
"must" : {
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"geo_distance" : {
"X.location" : "44.824971, -93.316218",
"distance" : "15.0mi"
}
}
}
}
}
}
}
Can someone pls explain why its behaving like this?
I'm getting issues with the GeoDistanceFilterBuilder. Below is the Java API code that create a GeoDistanceFilterBuilder.
fb = new GeoDistanceFilterBuilder("X.location").lon(Double.valueOf(longitude)).lat(Double.valueOf(lattitude)).distance(Double.valueOf(distance), DistanceUnit.MILES);
and this filter is appended to a match all query to finally get the below query.
{
"from" : 0,
"size" : 10,
"query" : {
"bool" : {
"must" : {
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"geo_distance" : {
"X.location" : [ 44.824971, -93.316218 ],
"distance" : "15.0mi"
}
}
}
}
}
}
}
However this does work but if i replace the Square brackets around the long/lat to quotes it does.Below is the working query.
{
"from" : 0,
"size" : 10,
"query" : {
"bool" : {
"must" : {
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"geo_distance" : {
"X.location" : "44.824971, -93.316218",
"distance" : "15.0mi"
}
}
}
}
}
}
}
Can someone pls explain why its behaving like this?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.