title: Store Map with Collection as Value in Elasticsearch
body: <p>I have a problem storing <code>private Map&lt;String, Set&lt;String&gt;&gt;</code> in elastic.</p>
  <p>For example, I have a variable <code>private Map&lt;String, Set&lt;String&gt;&gt; updatedFields</code> with the following content:</p>
  <pre><code>  &quot;updatedFields&quot;: {
      &quot;key1&quot;: [
        &quot;val1&quot;,
        &quot;val2&quot;,
        &quot;val3&quot;
      ],
      &quot;key2&quot;: [
        &quot;val1&quot;,
        &quot;val2&quot;,
        &quot;val3&quot;
      ]
    }
  </code></pre>
  <p>With the template mapping <code>&quot;updatedFields&quot;: {&quot;type&quot;: &quot;object&quot;}</code> elastic will create automappings for every key stored. This will lead to the following error if more than 1000 unique keys are stored:</p>
  <pre><code>failure in bulk execution:
  [0]: index [md_activity_log_stg_ii], type [_doc], id [969d12df-d2c4-446f-975a-d95e76d6e720], message [ElasticsearchException[Elasticsearch exception [type=mapper_parsing_exception, reason=failed to parse]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Limit of total fields [1000] has been exceeded while adding new fields [1]]];]
  </code></pre>
  <p>By changing the setting to <code>&quot;updatedFields&quot;: {&quot;type&quot;: &quot;object&quot;, &quot;enabled&quot;: false}</code> the object is stored but without any content of the array itmes
  Example of a document in Elastic after storing:</p>
  <pre><code>&quot;updatedFields&quot; : {
        &quot;34b49fbb-7ca8-4dc2-8c1f-21f88324b393&quot; : [ ]
   },
  </code></pre>
  <p>Anyone knows you to configure the field so that map is correctly stored without exceeding the field limit?</p>