I can't find any examples of how to structure an array of strings in elasticsearch when trying to PUT a mapping to an index.
What I have for the field mapping:
:tags {:type :array :store true}
The error i get:
{:type "mapper_parsing_exception", :reason "No handler for type [array] declared on field [tags]"}
In Elasticsearch, there is no dedicated array type. Any field can contain zero or more values by default, however, all values in the array must be of the same datatype. So you don't have to specify anything specific in the mapping to store an array of values.
Mapping is the process of defining how a document, and the fields it contains, are stored and indexed. Each document is a collection of fields, which each have their own data type. When mapping your data, you create a mapping definition, which contains a list of fields that are pertinent to the document.
These can be accessed from your dashboard by choosing Stack Settings > Elasticsearch . The next step is to write a a curl -x get command to retrieve the mappings from Elasticsearch. You will be returned with a json output similar to the below screenshot.
In Elasticsearch, there is no dedicated array type. Any field can contain zero or more values by default, however, all values in the array must be of the same datatype.
So you don't have to specify anything specific in the mapping to store an array of values.
For more information look at: https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html
Just write
:tags { "type" : "text" }
It works for store array in Elasticsearch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With