I need to have a field be searchable using both full text and exact match searches. I've been creating a separate field doing something like "name" and "name_raw", but reading the documentation I see that collapsed fields look like a nice way to resolve this, e.g.:
{
"properties": {
"user": {
"properties": {
"name": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
}
Would that be considered a best practice? Is there any reason not to do this?