# Search as like in elaticsearch with vietnamese

**URL:** <https://discuss.elastic.co/t/search-as-like-in-elaticsearch-with-vietnamese/146293>\
**Category:** Elasticsearch\
**Created:** [August 28, 2018, 8:44am UTC](https://discuss.elastic.co/t/search-as-like-in-elaticsearch-with-vietnamese/146293 "2018-08-28T08:44:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PhamVanTruong](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/phamvantruong/32/34870_2.png) [@PhamVanTruong](https://discuss.elastic.co/u/PhamVanTruong)\
**Post date:** [August 28, 2018, 8:44am UTC](https://discuss.elastic.co/t/search-as-like-in-elaticsearch-with-vietnamese/146293/1 "2018-08-28T08:44:49Z")

</div>

I use package elaticsearch in laravel framework:

> **[elasticquent/Elasticquent](https://github.com/elasticquent/Elasticquent)**
>
> Maps Laravel Eloquent models to Elasticsearch types - elasticquent/Elasticquent

I has task search name customer when i enter name into input search.  
I want search as like in elacticsearch. I want typing "an" will return "Tân", "Ánh","Bằng",..

this is query search api :

```
public function autocomplete(Request $request)
{
    $name = $request->query('q');
    $customers = Customer::searchByQuery([
        'wildcard' => [ 
            'name' => '*'.$name.'*'
        ]
    ]);
}   

```

This is model customer :  
class Customer extends Model  
{  
use ElasticquentTrait;

```
        protected $table = 'customers';
        protected $fillable = ['name'];
        protected $hidden = ['created_at', 'updated_at', 'deleted_at'];

        protected $mappingProperties = array(
            'name' => [
                'type' => 'text',
                "analyzer" => "standard",
            ],
        );
        
        protected $indexSettings = [
            'analysis' => [
                'analyzer' => [
                    'my_custom_analyzer' => [
                        'type' => 'custom',
                        'char_filter' => [
                            'html_strip',
                            'replace',
                        ],
                        'tokenizer' => 'standard',
                        'filter' => [
                            'lowercase',
                            'asciifolding',
                        ],
                    ],
                ],
            ],
        ];
    }

```

I hope someone can help me. Thanks you very much

---

<div class="post-metadata">

**Author:** ![Ethan-Zhang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ethan-zhang/32/54812_2.png) [@Ethan-Zhang](https://discuss.elastic.co/u/Ethan-Zhang)\
**Post date:** [August 28, 2018, 9:47am UTC](https://discuss.elastic.co/t/search-as-like-in-elaticsearch-with-vietnamese/146293/2 "2018-08-28T09:47:21Z")

</div>

> [@PhamVanTruong](#):
>
> an

"an" is an english word though "Tân", "Ánh","Bằng" are vietnamese words. So you should try search useing a vietnamese word. And I don't think the wildcard query support vietnamese.

---

<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:** [September 25, 2018, 9:47am UTC](https://discuss.elastic.co/t/search-as-like-in-elaticsearch-with-vietnamese/146293/3 "2018-09-25T09:47:32Z")

</div>

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