Unable to apply multiple analyzer


(kanchan) #1

Hi,

I have created custom analyzer like this:
PUT /historical_new_one/_settings
{
"settings": {
"analysis": {
"filter": {
"StopFilterFactory": {
"type": "stop",
"stopwords": "english",
"ignoreCase": true
},
"ASCIIFoldingFilterFactory": {
"type": "asciifolding",
"preserve_original" : false
},
"EdgeNGramFilterFactory": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 250
},
"LowerCaseFilterFactory": {
"type": "lowercase"
},
"TrimFilterFactory": {
"type": "trim"
},
"SynonymFilterFactory": {
"type": "synonym",
"synonyms_path" : "/opt/elasticsearch-5.3.0/config/synonyms.txt",
"ignoreCase": true,
"expand": true
}
},

     "analyzer": {
        "text_general_best": {
           "tokenizer": "keyword",
           "filter": [
              "StopFilterFactory",
              "LowerCaseFilterFactory",
              "TrimFilterFactory",
              "ASCIIFoldingFilterFactory",
      "EdgeNGramFilterFactory"        
           ]
        },
           "exactish": {
           "tokenizer": "keyword",
           "filter": [
              
              "LowerCaseFilterFactory"
           ]
        },
           "text_general_likely_new": {
           "tokenizer": "standard",
           "filter": [
              "StopFilterFactory",
              "LowerCaseFilterFactory",
              "SynonymFilterFactory",
              "ASCIIFoldingFilterFactory"        
           ]
        }
     }
  }

}
}

which acknowledge true, but when i tried to use this multiple custom analyzer(text_general_best,exactish,text_general_likely_new) like this:

GET /historical_new_one/_search
{

"query": {

  "bool": {
   
  
    
    "must": [
      {
        
        "match": {
         
          "bank_client_entity_name": {
            "query": "Federal",
            "analyzer": ["text_general_likely_new","text_general_best","exactish"]
     
            
          }
          
          
        }
      }
    ]
       }

}
}

It is showing error:

{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[match] unknown token [START_ARRAY] after [analyzer]",
"line": 16,
"col": 29
}
],
"type": "parsing_exception",
"reason": "[match] unknown token [START_ARRAY] after [analyzer]",
"line": 16,
"col": 29
},
"status": 400
}

Please reply for possible ways to use multiple analyzer at a time.


(tri-man) #2

finding the exact cause in this case sometimes is very challenging... I normally do one at a time (like setting up a filter, test it... if it works, add the next filter, etc... then an analyzer and so on) Otherwise, it's hard to tell.


(system) #3

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