title: Elasticsearch index comma-separated values and use them as filters
body: <p>I am currently indexing the <code>element</code> field as <code>"element" : "dog,cat,mouse"</code> with the following configuration:</p>
  
  <p><strong>ES config</strong>:</p>
  
  <pre><code>"settings": {
      "analysis": {
          "analyzer": {
              "search_synonyms": {
                  "tokenizer": "whitespace",
                  "filter": [
                      "graph_synonyms",
                      "lowercase",
                      "asciifolding"
                  ],
              },
              "comma" : {
                  "type" : "custom",
                  "tokenizer" : "comma"
              }
          },
          "filter": {
              "graph_synonyms": {
                  ...
              }
          },
          "normalizer": {
              "normalizer_1": {
                  ...
              }
          },
          "tokenizer" : {
              "comma" : {
                  "type" : "pattern",
                  "pattern" : ","
              }
          },
      }
  },
  </code></pre>
  
  <p><strong>Fields mapping</strong>:</p>
  
  <pre><code>"mappings": {
      "properties": {
          "element": {
              "type": "keyword",
              "normalizer": "normalizer_1"
          }
          ................
      }
  }
  </code></pre>
  
  <p>The value <code>dog,cat,mouse</code> is used afterwards as a filter but I want to separate them and use each value as a separated filter. I tried to use <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.6/multi-fields.html#_multi_fields_with_multiple_analyzers" rel="nofollow noreferrer">multi-fields</a> feature and made the following changes but I'm still not sure what else should I do.</p>
  
  <pre><code>"element": {
      "type": "keyword",
      "normalizer": "normalizer_1",
      "fields": {
          "separated": {
              "type": "text",
              "analyzer": "comma"
          }
      }
  },
  </code></pre>