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!

You can just use keyword.
In ElasticSearch every field is already an array, see the docs here:
https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html

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.