Hello,
I'm having trouble getting a simple aggs query to return data.
GET mydata1/_search
{
"aggs": {
"avg_num_days": {
"avg": {
"field": "myField"
}
}
}
}
I was getting an error:
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Field [myField] of type [keyword] is not supported for aggregation [avg]"
}
I did some searches on the internet and found I needed this field to be a long, not a keyword as aggs don't work on keywords. I deleted the index and tried to do a PUT explicit mapping, but since the index is gone that wont work. I know I have to get this declared before the index is created, but what is the proper way change the datatype for this single field so I can run aggs against it?
All the other fields are automatically mapped properly by Elasticsearch when I import the data, a single CVS, standalone file that I upload to Kibana.
Thank you,
James