Hello,
I am trying to get all the values for a filed with count using Aggregation Here is my code
Query searchQuery = new NativeSearchQueryBuilder()
.withQuery(QueryBuilders.matchAllQuery())
.addAggregation(AggregationBuilders.terms("ProgramNames").field("measurementName").order(BucketOrder.key(true)))
.build();
SearchHits<Measurement> meas = elasticsearchTemplate.search(searchQuery, Measurement.class);
i am able to get the docCount in bucket but not the keyAsString keyAsString is always null. am i looking correct places for the result.
i am trying to build facets for measurementName field.
mea(3)
measR(4)
meart(6)