-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support aggregations on scripted fields #267
Comments
@stevedodson / @sethmlarson
curl -X GET "localhost:9200/flights/_search?pretty" -H 'Content-Type: application/json' -d'
{
"size": 0,
"aggs": {
"cardinality_scripted": {
"cardinality": {
"script": {
"source": "doc[\"DistanceKilometers\"].value+doc[\"DistanceMiles\"].value"
}
}
},
"min_scripted": {
"sum": {
"script": {
"source": "doc[\"DistanceKilometers\"].value+doc[\"DistanceMiles\"].value"
}
}
}
}
}
' This works for all aggs. Please give me some inputs 😄 |
@V1NAY8 For some scripts we probably can't aggregate (like you've found with text). We should add test cases for the scripted fields we currently support to make sure we maintain support. This is one area that we need more test case coverage :) Maybe you can start by adding some test cases and figuring out exactly what currently works and what doesn't then we can go from there? |
Yes, I can do that. I'll add test cases and try to implement moving scripts inside aggs. 😄 |
The following code exposed a issues with scripted fields:
Assigning a new field based on concat of 2 fields failed:
Aggs on scripted fields:
This returns 0 rather than the results of:
This is probably due to aggs not works on scripted fields unless script is in the agg. i.e.
returns 0 results.
The text was updated successfully, but these errors were encountered: