elastic_client
elastic_client copied to clipboard
Exception when searching using aggregation
First of all, thank you for creating an maintaining the project!
I started using flutter with elastic search yesterday and started using this package.
But when searching with an aggregation I unfortunately got an error in https://github.com/isoos/elastic_client/blob/master/lib/src/elastic_client_impl.dart in lines 130-134.
name = name;
value = m['value'];
values = m['values'] as Map;
docCountErrorUpperBound = m['doc_count_error_upper_bound'] as int;
sumOtherDocCount = m['sum_other_doc_count'] as int;
My search query:
client.search(index: 'sensordata', type: '', aggregations: {
'values': {
'composite': {
'sources': [
{
'value': {
'terms': {'field': 'sensorname'}
}
}
]
}
}
});
I looked up in the documentation https://pub.flutter-io.cn/documentation/elastic_client/latest/elastic_client/Aggregation-class.html and found that values for example should be of type Map? but is, as seen in the code block above of type Map.
After making the fields values, docCountErrorUpperBound and sumOtherDocCount nullable everything worked fine.
Can anybody confirm that problem?
Yeah, that may be of a problem. Would you be able to create a PR with the fix? I'd be happy to review and merge it...
Yeah, that may be of a problem. Would you be able to create a PR with the fix? I'd be happy to review and merge it...
Yeah sure.