hello guys,
i notice that in current version don't work min, max aggregations on "date" type fields.
i try to execute
var params = {
body: {
size: 0,
query: {
bool: {
must: [
{
range: {
'event_date': qrange
}
},
{
match: {
critical_degree: request.payload.critical_degree
}
}
]
}
},
aggs: {
agg_event_name: {
terms: {
field: "event_name",
size: 100
},
aggs: {
last_time: {
max: {
field: "event_date"
}
},
first_time: {
min: {
field: "event_date"
}
}
}
}
}
}
};var matchCondition = {}; matchCondition.match = {}; matchCondition.match[request.payload.type] = request.payload.value; params.body.query.bool.must.push(matchCondition);
field event_date has type "date"
then i try to set fielddata on true. but elasticsearch don't allowed do it.
so after i try add keyword
"event_date" : {
"type" : "date",
"fields" : {
"keyword" : {
"type" : "keyword"
}
}
},
but elasticsearch return same exception:
Fielddata is disabled on text fields by default. Set fielddata=true on [event_date] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.
any advice?