私は単純な nlp ツールを開発しており、elasticsearch-dsl を django の es ツールとして使用しています。
Entity と Intent の 2 つの「DocType」があります。私は次のような独自のアナライザーを作成しました。
turkish_stop = token_filter('turkish_stop', type='stop', stopwords="_turkish_")
turkish_lowercase = token_filter('turkish_lowercase', type='lowercase', language="turkish")
turkish_stemmer = token_filter('turkish_stemmer', type='stemmer', language='turkish')
turkish_analyzer = analyzer('turkish_analyzer', tokenizer='whitespace', filter=['apostrophe', 'asciifolding',
turkish_lowercase, turkish_stop,
turkish_stemmer])
各ドキュメントには、たとえばカスタム マッピングがあります。
class Entity(DocType):
entity_synonyms = String(analyzer=es.turkish_analyzer, include_in_all=True)
entity_key = String(index='not_analyzed', include_in_all=False)
class Meta:
index = es.ELASTICSEARCH_INDEX
doc_type = es.ELASTICSEARCH_ENTITY_DOCTYPE
ドキュメントhttp://elasticsearch-dsl.readthedocs.org/en/latest/persistence.html#persistenceによると。Entity.init() は、このドキュメントのマッピングを作成します。それは実際に私のesにマッピングを作成します(エンティティドキュメントのみ! :( )。ただし、Entity.init()の後、インテントで同じことを行うことができませんでした。以下のエラーが発生します:
IllegalOperation: You cannot update analysis configuration on an open index, you need to close index nlp first.
これを解決するアイデアはありますか?可能であれば、本当に Entity.init() と Intent.init() を使いたいです。