Elasticsearch突出显示碎片问题

时间:2018-12-04 08:43:37

标签: elasticsearch

我发现Elasticsearch如何突出显示文本的问题 例: 1.使用“统一”荧光笔时,

 "highlight": {
        "type" : "unified",
        "fields": {
            "*": {}
        } 

显示的结果是:

"highlight": {
                    "FILE_CONTENT": [
                        "follows: \n1)Test Clause\n1.1) test 29_May\nDummy values - \is - INR  \is - <em>standard</em>",
                        "<em>whitespace</em> \nStart Date is - 05/31/2018 \nhgdhdrgdffggggggggggggggggggggggggggggggggggggggggggggggjerklwagggggggggggggggggggggggggggggggggg"
                    ]

我们可以看到球和轴承同时突出显示,但显示为高亮阵列的不同元素。 2.使用“ fvh”荧光笔时也可以解决此问题:

"highlight": {
        "type" : "fvh",

        "fields": {
            "*": {}
        }
    }

突出显示为:

 "highlight": {
                    "FILE_CONTENT": [
                        "Currency is - INR  \is - <em>standard whitespace</em> \nStart Date is - 05/31/2018 \nhgdhdrgdffgggg"
                    ]
                }

对于某些速度问题,我无法使用Fvh荧光笔。我只能使用统一的荧光笔 根据{{​​3}}“ fragmentor”:“ span”应该可以解决此问题。但是我遇到了与不使用“ fragmentor”时相同的问题:“ span”。

"highlight": {
        "type" : "unified",
        "fragmenter": "span",
        "fields": {
            "*": {}
        }
    }

结果是:

"highlight": {
 "FILE_CONTENT": [
                        "follows: \n1)Test Clause\n1.1) test 29_May\nDummy values - \nCurrency is - INR  \is - <em>standard</em>",
                        "<em>whitespace</em> \nStart Date is - 05/31/2018 \nhgdhdrgdffggggggggggggggggggggggggggggggggggggggggggggggjerklwagggggggggggggggggggggggggggggggggg"
                    ] 
}

0 个答案:

没有答案