Elasticsearch не получается настроить html_strip

На проекте подключен, используется для поиска контекстного. Но не работает html_strip, и выдает в highlight такие ответы tbody>\n<tr>\n<td style=\"width: 18.029354724964737%;\">слово

Вот собрал в одно место код как происходит сохранение и как все прописано

from elasticsearch_dsl import Document, Integer, Text, ValidationException, analyzer, token_filter, tokenizer, Keyword

app_ngram = token_filter('app_ngram', type="nGram", min_gram=2, max_gram=20, token_chars=['letter'])
worddelimiter = token_filter('worddelimiter', language="russian")
ru_stemmer = token_filter('ru_stemmer', type="stemmer", language="Russian")
digit = token_filter('digit', type="standard", min_gram=1, max_gram=10, token_chars=['digit'])

html_strip = analyzer(
    'html_strip',
    tokenizer="standard",
    filter=[app_ngram, "asciifolding", "lowercase", worddelimiter, ru_stemmer, digit],
    char_filter=["html_strip"]
)
app_search_analyzer = analyzer(
    'app_search_analyzer',
    tokenizer="keyword",
    filter=[app_ngram, "asciifolding", "lowercase", worddelimiter, ru_stemmer, digit],
    char_filter=["html_strip"]
)

class MaterialIndex(Document):
    id = Integer()
    title = Text(analyzer=html_strip, search_analyzer=html_strip)
    text = Text(analyzer=html_strip, search_analyzer=html_strip, fields={'raw': Keyword()})

    class Meta:
        doc_type = 'material'

    class Index:
        name = 'material'

from rest_framework_elasticsearch.es_serializer import ElasticModelSerializer
from apps.section.indexes import MaterialIndex
from apps.section.models import Material


class ElasticMaterialMS(ElasticModelSerializer):

    class Meta:
        model = Material
        es_model = MaterialIndex
        fields = ('id', 'text', 'title')

Как происходит сохранение:

MaterialIndex.init()
obj = ElasticMaterialMS(instance)
obj.save()

Поиск по данным

from elasticsearch_dsl import Search

search_es = Search(doc_type='material')
search_es = search_es.from_dict(
    {
        "query": {
            "multi_match": {
                "query": search,
                    "fields": ["title", "text"]
            }
        }
    }
)
response = search_es.execute()
hits = response.hits.hits

Подскажите, что не так настроено.

Стeк на проекте Django3, python3, elasticsearch:7.11.0


Ответы (0 шт):