Python elasticsearch没有';t删除所有HTML或stopwords
我把我的wordpress帖子扔到Elasticsearch上,但在搜索建议词时,我仍然得到stopwords和html元素。例如,Python elasticsearch没有';t删除所有HTML或stopwords,python,wordpress,
elasticsearch,Python,Wordpress,
elasticsearch,我把我的wordpress帖子扔到Elasticsearch上,但在搜索建议词时,我仍然得到stopwords和html元素。例如,the,a甚至p标签。我已经在索引中指定使用这些过滤器 这是我的密码 es.indices.create( index='wp-posts', body={ 'settings': { # just one shard, no replicas for testing 'number_o
the
,a
甚至p
标签。我已经在索引中指定使用这些过滤器
这是我的密码
es.indices.create(
index='wp-posts',
body={
'settings': {
# just one shard, no replicas for testing
'number_of_shards': 1,
'number_of_replicas': 0,
# custom analyzer for analyzing file paths
'analysis': {
'analyzer': {
"my_analyzer": {
"type": "standard",
"stopwords": "_english_"
},
'wordpress_content': {
'type': 'custom',
'tokenizer': 'standard',
'filter': ['html_strip']
}
}
}
}
},
# Will ignore 400 errors, remove to ensure you're prompted
ignore=400
)
这就是我寻求建议的方式。除非我做错了什么
result = es.suggest(index="wp-posts", body={"my_suggestion": {"text": post['content'], "term": {"field":"content" }}})