We're using ES2.3. What would be the recommended mapping / type for storing JSON in fields? Also, what would be the maximum recommended length of these fields? We don't need the field to be analysed and it will never form part of a query. The field will simply be indexed, then returned when some other field in the doc matches a search.
The field could be quite large as it will contain an array of JSON objects defining a subset of user data that contains name, email address and greeting. Effectively the field will contain the result of a targeting exercise against a set of users, the field will then be used to drive an email process that sends email to these users. This could result in 10's to 100's of thousands of users to email.
If we had some understanding of max field length then we could work out how many documents we'd need to split a targeting result across.
We really do not want to use a doc per user targeted as this will quickly get out of hand in terms of scale.
Any insights would be much appreciated.
you may index it with a mapping like (source):
"json_field": {
"type": "string",
"index": "no"
The whole document will be stored, but this field won't be indexed - so it won't be available for search and won't mess up your index. We also had this applied for static information like hyperlinks to detail-pages or product images.
According to this thread, you won't have to face a maximum field length as well. Still you'll have to be aware of the maximum Java heap size (source), when storing large documents.
I hope this solves your question! As this is my first answer on stackoverflow, your feedback will be highly appreciated!
Cheers, Dominik