我正在开发一个简单的nlp工具,并将elasticsearch-dsl用作django的es工具。
我将有两个"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上创建映射(仅用于实体doc!:( )。但是,在Entity.init()之后,我不能有意图地做同样的事情。它给出了以下错误:
IllegalOperation: You cannot update analysis configuration on an open index, you need to close index nlp first.有办法解决这个问题吗?如果可能的话,我非常想使用Entity.init()和Intent.init()。
https://stackoverflow.com/questions/34865507
复制相似问题