只是想知道。 是否可以使用 _source = false 在索引上突出显示 ElasticSearch 中的文本?
我的意思是,我知道如果 ES 没有文档,他就无法进行突出显示,但是有没有办法只使用 ES 作为突出显示引擎,而不是使用突出显示的完整搜索引擎? (我在突出显示查询中提供了完整的文档)
谢谢
最佳答案
我不相信这是可能的。
但是,您可以在搜索查询和文档上使用 _analyze,然后比较标记以在代码中突出显示。
例如:
curl -XGET 'localhost:9200/test/_analyze?analyzer=snowball' -d 'some search query keywords'
{"tokens":[{"token":"some","start_offset":0,"end_offset":4,"type":"","position":1},{"token":"搜索","start_offset":5,"end_offset":11,"type":"","position":2},{"token":"query","start_offset":12,"end_offset":17, “类型”:“”,“位置”:3},{“ token ”:“关键字”,“start_offset”:18,“end_offset”:26,“类型”:“”,“位置”:4}]}
curl -XGET 'localhost:9200/test/_analyze?analyzer=snowball' -d '$document_text'
{“ token ”:..}
然后在文档中查找那些标记匹配,偏移量应该为您提供文档中正确的突出显示位置。
关于lucene - 在 ElasticSearch 中使用突出显示 _source :false,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11042162/