[英]How is ElasticSearch queried using the Java client?
The site only has documentation for JSON, but not the Java client. 该站点仅包含JSON的文档,但不包含Java客户端。 Is there some sort of mapping I should be performing?
我应该执行某种映射吗?
For example geo location queries: http://www.elasticsearch.org/guide/reference/query-dsl/geo-distance-range-filter.html 例如地理位置查询: http : //www.elasticsearch.org/guide/reference/query-dsl/geo-distance-range-filter.html
How would such a query be written using the Java client? 如何使用Java客户端编写这样的查询?
Thanks Jason 谢谢杰森
Not obvious but not that complicated ;) 不明显但不那么复杂;)
SearchRequestBuilder srb = client.prepareSearch(index);
srb.setQuery(QueryBuilders.matchAllQuery());
srb.setFilter(FilterBuilders.geoDistanceRangeFilter("filter1").lat(1234).lon(4321).geoDistance(GeoDistance.PLANE) ..... );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.