Ngram Analyze not working for forward slash '/'


#1

Hi ,

Created index with ngram analyser

POST my_index

{
            "settings": {
              
                "analysis": {
                  "filter": {
                     "nGram_filter": {
                        "type": "nGram",
                        "min_gram": 3,
                        "max_gram": 3,
                        "token_chars": [
                           "letter",
                           "digit",
                           "punctuation",
                           "symbol",
                           "whitespace"
                        ]
                     }
                  },
                  "analyzer": {
                     "nGram_analyzer": {
                        "type": "custom",
                        "tokenizer": "standard",
                        "filter": [
                           "lowercase",
                           "asciifolding",
                           "nGram_filter"
                        ]
                     }
                  }
               }
            },
            "mappings": {
                "doc": {
                  "dynamic_templates": [
                    {
                      "full_name": {
                        "path_match":   "name.*",
                        "mapping": {
                          "type":       "text",
                          "term_vector": "yes",
                          "analyzer": "nGram_analyzer",
                          "index": true,
                          "copy_to":    "full_name"
                        }
                      }
                    }
                  ]
                }
            }
        }

Using analyser 'nGram_analyzer'

POST my_index/_analyze
{
"analyzer": "nGram_analyzer",
  "text": "26/12/2014"
}

OUTPUT

{  
   "tokens":[  
      {  
         "token":"201",
         "start_offset":6,
         "end_offset":10,
         "type":"<NUM>",
         "position":2
      },
      {  
         "token":"014",
         "start_offset":6,
         "end_offset":10,
         "type":"<NUM>",
         "position":2
      }
   ]
}

ngram Analyser not working for date with slash. Please help here.


(system) #2

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