Exercises: token
type
Refer back to the string
section above for details on configuring the token
field type.
equals
on stringsβ
π Playground link: equals
on string
mismatch
The category field is a string. Try using the string
field type - why doesn't it work? What's the right type to use in order to use the equals
operator?
Solution
The token
type must be manually/statically mapped; it is not dynamically mapped.
{
"mappings": {
"dynamic": true,
"fields": {
"category": [
{
"type": "token"
}
]
}
}
}
in
and range
on stringsβ
Similarly, the token
field type is needed to do in
and range
queries on exact strings.