Mapping for an array of keywords

What does the JSON mapping look like if I have a field that is of type: keyword array.

If I wanted multiple keywords associated with a JSON document, how would I create the mapping for the index's field?

Something like:
"my_index" : {
"mappings" : {
"item": {
"properties" : {
"NickNames" : { "type" : "keyword array"}
}
}
}
}

Thanks!

1 Like

You can just use keyword.
In Elasticsearch every field is already an array, see the docs here:

Array support does not require a dedicated type

And you can set a single value or multiple values when indexing the documents:
{"nickNames": "foo"}
{"nickNames: ["foo"]}
{"nickNames: ["foo", "bar"]}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.