The solution is to create a text
field with a keyword
sub-field so that you can do both, search text and aggregate values:
Your field mapping should look like this:
{
"my_field": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
Using the above mapping, you can search on the my_field
field and aggregate and my_field.keyword
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…