How to add Multiple analyzers to specific field


(anvesh) #1

Hi,

I am working on ES 6.x i want to apply multiple analyzers to specific field. Any suggestions that i can implement.


(Lee Hinman) #2

HI Anvesh,

For applying multiple analysers, I would recommend that you check out "multi fields". This allows you to analyze a field in as many ways as you'd like.

There's an example here:
https://www.elastic.co/guide/en/elasticsearch/reference/6.4/multi-fields.html

Where the city field is analyzed as both text and keyword. You can do the same thing with analyzers:

PUT my_index
{
  "mappings": {
    "_doc": {
      "properties": {
        "myfield": {
          "type": "text",
          "analyzer": "standard",
          "fields": {
            "english": { 
              "type":  "text",
              "analyzer": "english"
            }
          }
        }
      }
    }
  }
}

In that case, the myfield field will be analyzed with two different analyzers ("standard" and "english")


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.