1

How to make compound query, as example I need to find geojson data with some properties (these properties is set in search query) within some polygon?

I know there are the GeoPolygonQueryBuilder and the BoolQueryBuilder for these kind of requests, but how to use them together in a single request to fetch data from ES?

Thanks!

1 Answer 1

1

This is a shot in the dark, because your question is lacking a minimal, reproducible example or even pseudo-code. If you are asking how to write a query that combines two sub queries, use the BoolQueryBuilder and provide multiple mandatory sub queries:

final BoolQueryBuilder query = new BoolQueryBuilder()
        .must(new GeoPolygonQueryBuilder(
                   "geo_field",
                   List.of(new GeoPoint(14, 50), …)))
        .must(new GeoPolygonQueryBuilder(
                   "geo_field",
                   List.of(new GeoPoint(14, 50), …)));

BoolQueryBuilder has additional methods such as mustNot, should, or filter.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.