Java API-GeoDistanceFilterBuilder not working as desired [Some issue with generated square brackets]

Hi,

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?

Thanks,
John

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

When using arrays, the format is [lon, lat]. See:
Elasticsearch Platform — Find real-time answers at scale | Elastic

David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 1 févr. 2013 à 22:01, john john2roll2@gmail.com a écrit :

Hi,

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?

Thanks,
John

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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.