I'm trying to aggregate IMap's values but I'm getting the below error:
com.hazelcast.map.impl.query.QueryPartitionOperation
SEVERE: [192.168.99.1]:5701 [dev] [3.12.3] java.lang.IllegalArgumentException: There is no suitable accessor for 'john' on class 'java.lang.String'
Here is a reproducer:
HazelcastInstance hazelCast = Hazelcast.newHazelcastInstance();
IMap<String, String> map1 = hazelCast.getMap("map1");
map1.put("1", "john");
map1.put("2", "charlie");
map1.put("3", "john");
map1.put("4", "john");
Long count = map1.aggregate(Aggregators.count("john"));
System.out.println(count);
You should use the following aggregate function of IMap :
like this :