Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Search using BooleanQueryBuilder and GeoShapeQueryBuilder results in "Current context not an ARRAY but OBJECT" #3878
First of all, thanks for building such an amazing service. I am loving my experience with ElasticSearch so far.
What I've run into is that trying to use the BooleanQueryBuilder in conjunction with the GeoShapeQueryBuilder is resulting in the following exception.
Here is my code to build and execute the query:
GeoShapeQueryBuilder geoQuery = QueryBuilders.geoShapeQuery("searchGeometry", new RectangleImpl(y1, y2, x1, x2, SpatialContext.GEO)); BoolQueryBuilder query = QueryBuilders.boolQuery(); if (featureIds.length > 0) query.must(QueryBuilders.termQuery("featureType", featureIds)); query.must(geoQuery); SearchRequestBuilder request = esClient.prepareSearch("index_name") .setSearchType(SearchType.QUERY_THEN_FETCH) .setQuery(query) .setFrom(0) .setSize(maxResults) .setExplain(false); SearchResponse response = request.execute().actionGet();
Am I doing something wrong? I have a feeling I am but it looks right to me.
This isn't a big deal for me, because I can just build a JSON query manually and that works perfectly fine. However it'd be nice to be able to use the QueryBuilders as make the code much easier to read.