# Highlight длинной строки

**URL:** <https://discuss.elastic.co/t/highlight/64101>\
**Category:** Вопросы на русском языке\
**Created:** [October 27, 2016, 6:29am UTC](https://discuss.elastic.co/t/highlight/64101 "2016-10-27T06:29:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![generak13](https://avatars.discourse-cdn.com/v4/letter/g/f1d935/32.png) [@generak13](https://discuss.elastic.co/u/generak13)\
**Post date:** [October 27, 2016, 6:29am UTC](https://discuss.elastic.co/t/highlight/64101/1 "2016-10-27T06:29:00Z")

</div>

Доброго время суток!  
Делаю подсветку строк с такими параметрами:

```
'highlight' => array(
  'pre_tags' => array('<int>'),
  'post_tags' => array('</ins>'),
  'fields' => array(
    text' => array('type' => 'fvh'),
  )
)

```

Она хорошо работает, но когда делаю подсветку длинной строки - тогда мне возвращаються фрагменты строки, которые подсвечены. Пример ответа от Еластика:

```
[_source] => Array
                (
                    [id] => 3206829
                    [text] => Coming to life as a chunk of stone, Tiny's origins are a mystery on which he continually speculates. He is a Stone Giant now, but what did he used to be? A splinter broken from a Golem's heel? A shard swept from a gargoyle-sculptor's workshop? A fragment of the Oracular Visage of Garthos? A deep curiosity drives him, and he travels the world tirelessly seeking his origins, his parentage, his people. As he roams, he gathers weight and size; the forces that weather lesser rocks, instead cause Tiny to grow and ever grow.	
                )

            [highlight] => Array
                (
                    [text] => Array
                        (
                            [0] => <ins>Coming</ins> to life as a chunk of stone, Tiny&#x27;s origins are a mystery on which he continually speculates.
                            [1] => Stone Giant now, but what did he used to be? A <ins>splinter</ins> broken from a Golem&#x27;s heel? A shard swept from
                            [2] => workshop? A fragment of the <ins>Oracular Visage of Garthos</ins>? A <ins>deep</ins> <ins>curiosity</ins> <ins>drives</ins> him, and he travels the world
                            [3] => tirelessly seeking his origins, his parentage, his <ins>people</ins>. As he roams, he gathers weight and size; the forces
                        )

                )
        )

```

Хотелось бы получить всю подсветку в одной строке. Сейчас чтоб получить всю строку надо делать постпроцесинг, заменяя части строк оригинальной строки на "подсветку". Можно ли както указать Еластику возвращать сразу всю подсвечену строку, а не фрагментЬІ подсветок?

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [October 27, 2016, 2:51pm UTC](https://discuss.elastic.co/t/highlight/64101/2 "2016-10-27T14:51:09Z")

</div>

Как указано в секции [Highlighted Fragments](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/search-request-highlighting.html#_highlighted_fragments) документации, по умолчанию возвращается до 5 фрагментов. Фрагментацию можно отключить задав `0` в параметре `number_of_fragments`.

```auto
'highlight' => array(
  'pre_tags' => array('<int>'),
  'post_tags' => array('</ins>'),
  'fields' => array(
    text' => array('type' => 'fvh', 'number_of_fragments' => 0),
  )
)

```

---

<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, 1:44pm UTC](https://discuss.elastic.co/t/highlight/64101/3 "2017-07-06T13:44:37Z")

</div>

Closed on July 6, 2017, 1:44pm UTC


