# Поиск по части слова в кириллице php

**URL:** <https://discuss.elastic.co/t/php/70531>\
**Category:** Вопросы на русском языке\
**Created:** [January 4, 2017, 9:32am UTC](https://discuss.elastic.co/t/php/70531 "2017-01-04T09:32:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![folt](https://avatars.discourse-cdn.com/v4/letter/f/5e9695/32.png) [@folt](https://discuss.elastic.co/u/folt)\
**Post date:** [January 4, 2017, 9:32am UTC](https://discuss.elastic.co/t/php/70531/1 "2017-01-04T09:32:56Z")

</div>

> **[elastic/elasticsearch-php](https://github.com/elastic/elasticsearch-php)**
>
> elasticsearch-php - Official PHP low-level client for Elasticsearch.

  
Такая проблема:  
Добавил в индекс элементы  
Пытаюсь найти по части слава, но приходит пустой массив. Но когда ищу по полному слову - приходят все данные с ним.

```
require $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
$client = Elasticsearch\ClientBuilder::create()->build();
$q = trim(htmlspecialcharsEx($_REQUEST['q']));

$params = [
    'size' => 3000,
    'index' => 'catalog',
    'type' => 'products',

    'body' => [
        'query' => [
            'bool' => [
                'should' =>[
                    'multi_match' => [
                        'query' => $q ,
                        'prefix_length' => 2,
                        'fields' => [
                            'name',
                            'preview',
                            'detail',
                            'brand',
                            'section_name'
                        ]
                    ]
                ]
            ]
        ]
    ]
];
$result = $client->search($params);

if(!empty($result['hits']))
{
    $prodID = [];
    foreach($result['hits']['hits'] as $item )
    {
        $prodID[$item['_id']] = $item['_id'];
    }

    prent($prodID,1,1); die();
}
```

---

<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:** [February 1, 2017, 9:32am UTC](https://discuss.elastic.co/t/php/70531/2 "2017-02-01T09:32:56Z")

</div>

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