【发布时间】:2017-06-12 09:16:45
【问题描述】:
我有一个 html 文件,我需要找到完全匹配字符串的部分,比如“ANNUAL REPORT PURSUANT”。我正在使用最新版本的 Elasticsearch 5.4.0。我是弹性搜索的新手。对于索引,我将分析器定义如下:
{
"index_name": {
"settings": {
"index": {
"number_of_shards": "5",
"provided_name": "index_name",
"creation_date": "1496927173220",
"analysis": {
"analyzer": {
"contact_section_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"pattern": "(ANNUAL REPORT PURSUANT)",
"type": "pattern",
"group": "1"
}
}
},
"number_of_replicas": "1",
"uuid": "vF3cAe-STJW-GrVxc7N8ww",
"version": {
"created": "5040099"
}
}
}
}
}
现在我正在尝试使用如下分析来获得偏移量:
POST localhost:9200/sag_sec_items6/_analyze?pretty
{
"analyzer": "contact_section_analyzer",
"text": "my_html_file_contents_already_indexed"
}
返回:
{
"tokens": []
}
我检查了包含该文本的 html 文件。
使用带有单个 _id 的 _search 查询,我得到了整个 html 文件。 如何获取包含该文本的 偏移量或 html 标记。
【问题讨论】:
标签: elasticsearch analyzer elasticsearch-5