Elastic analyser question

Hello.

I'm new at elastic and was wondering how would I go about creating an analyzer that could analyze this kind of string:
PBGT_098122.

The elastic should return this string when the user types

  • pbgt09
  • 09
  • 812
  • gt09

Thank you for any help!

-John

you will probably need custom analyzer with lower case and shingle. for shingle, take note on the min and max configuration. https://www.elastic.co/blog/searching-with-shingles

hth

Hello.

So I've tried to add the analyzer like this:

PUT /tests
{
   "settings":{
      "index":{
         "analysis":{
            "analyzer":{
               "analyzer_shingle":{
                  "tokenizer":"standard",
                  "filter":["filter_shingle", "custom_word", "lowercase"]
               }
            },
            "filter":{
               "filter_shingle":{
                  "type":"shingle",
                  "max_shingle_size":25,
                  "min_shingle_size":2
               },
            "custom_word":{
                 "type": "word_delimiter",
                 "catenate_numbers" : true,
                 "preserve_original" : true 
            }
            }
         }
      }
   },
   "mappings":{
      "test":{
         "properties":{
            "name":{
               "search_analyzer":"analyzer_shingle",
               "index_analyzer":"analyzer_shingle",
               "type":"string"
            }
         }
      }
   }
}

And added an example entry:

POST /tests/test/
{  
    "name":"HRAG_1234"  
}

And tested it like this:

GET /tests/_search?q=hr //doesn't return anything
GET /tests/_search?q=12 //doesn't return anything
GET /tests/_search?q=hrag //doesn't return anything
GET /tests/_search?q=1234 //doesn't return anything
GET /tests/_search?q=hrag_1234 //returns hrag_1234

Thank you for any info.

-John