Alkis Kalogeris
Alkis Kalogeris

Reputation: 17765

Enable stop token filter for standard analyzer

I'm using ElasticSearch 5.1 and I want to enable the Stop Token Filter for the standard analyzer which is disabled by default The document describes how to use it in a custom analyzer, but I would like to know how to enable it, since it's already included.

Upvotes: 0

Views: 137

Answers (1)

groo
groo

Reputation: 4448

you have to configure the standard analyzer, see the example below how to do it with curl command(taken from docs here):

curl -XPUT 'localhost:9200/my_index?pretty' -d'
{
  "settings": {
    "analysis": {
      "analyzer": {
        "std_english": { 
          "type":      "standard",
          "stopwords": "_english_"
        }
      }
    }
  },
  "mappings": {
    "my_type": {
      "properties": {
        "my_text": {
          "type":     "text",
          "analyzer": "standard", 
          "fields": {
            "english": {
              "type":     "text",
              "analyzer": "std_english" 
            }
          }
        }
      }
    }
  }
}'
curl -XPOST 'localhost:9200/my_index/_analyze?pretty' -d'
{
  "field": "my_text", 
  "text": "The old brown cow"
}'
curl -XPOST 'localhost:9200/my_index/_analyze?pretty' -d'
{
  "field": "my_text.english", 
  "text": "The old brown cow"
}'

Upvotes: 1

Related Questions