# Elastic analyser question

**URL:** <https://discuss.elastic.co/t/elastic-analyser-question/2625>\
**Category:** Elasticsearch\
**Created:** [June 13, 2015, 5:48pm UTC](https://discuss.elastic.co/t/elastic-analyser-question/2625 "2015-06-13T17:48:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnB](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@JohnB](https://discuss.elastic.co/u/JohnB)\
**Post date:** [June 13, 2015, 5:48pm UTC](https://discuss.elastic.co/t/elastic-analyser-question/2625/1 "2015-06-13T17:48:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [June 14, 2015, 1:12am UTC](https://discuss.elastic.co/t/elastic-analyser-question/2625/2 "2015-06-14T01:12:28Z")

</div>

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](https://www.elastic.co/blog/searching-with-shingles)

hth

---

<div class="post-metadata">

**Author:** ![JohnB](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@JohnB](https://discuss.elastic.co/u/JohnB)\
**Post date:** [June 30, 2015, 5:08pm UTC](https://discuss.elastic.co/t/elastic-analyser-question/2625/3 "2015-06-30T17:08:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:04am UTC](https://discuss.elastic.co/t/elastic-analyser-question/2625/4 "2017-07-06T00:04:29Z")

</div>


