title: Removing stopwords from basic Terms aggregation in Elasticsearch?
body: <p>I'm a little new to Elasticsearch, but basically I have an single index called <code>posts</code> with multiple <code>post</code> documents that take the following form:</p>
  
  <pre><code>"post": {
      "id": 123,
      "message": "Some message"
  }
  </code></pre>
  
  <p>I'm trying to get the most frequently occurring words in the <code>message</code> field across the entire index, with a simple Terms aggregation:</p>
  
  <pre><code>curl -XPOST 'localhost:9200/posts/_search?pretty' -d '
  {
      "aggs": {
          "frequent_words": {
              "terms": {
                  "field": "message"
              }
          }
      }
  }
  '
  </code></pre>
  
  <p>Unfortunately, this aggregation includes stopwords, so I end up with a list of words like "and", "the", "then", etc. instead of more meaningful words.</p>
  
  <p>I've tried applying an analyzer to exclude those stopwords, but to no avail:</p>
  
  <pre><code>curl -XPUT 'localhost:9200/posts/?pretty' -d '
  {
      "settings": {
          "analysis": {
              "analyzer": {
                  "standard": {
                      "type": "standard",
                      "stopwords": "_english_"
                  }
              }
          }
      }
  }'
  </code></pre>
  
  <p>Am I applying the analyzer correctly, or am I going about this the wrong way? Thanks!</p>