Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance 突出显示稀疏字段的弹性搜索速度较慢_Performance_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Highlight_Sparse Matrix - Fatal编程技术网 elasticsearch,highlight,sparse-matrix,Performance,elasticsearch,Highlight,Sparse Matrix" /> elasticsearch,highlight,sparse-matrix,Performance,elasticsearch,Highlight,Sparse Matrix" />

Performance 突出显示稀疏字段的弹性搜索速度较慢

Performance 突出显示稀疏字段的弹性搜索速度较慢,performance,elasticsearch,highlight,sparse-matrix,Performance,elasticsearch,Highlight,Sparse Matrix,我最近开始使用elasticsearch。我的文档中存在父子关系,但我决定将子项存储在编号字段中。例如: { "id": "1", "name": "parent1", "child": { "1": { "id": "13" "content": "child 13 content" }, "2": { "id": "25" "

我最近开始使用elasticsearch。我的文档中存在父子关系,但我决定将子项存储在编号字段中。例如:

{
    "id": "1",
    "name": "parent1",
    "child": {
        "1": {
            "id": "13"
            "content": "child 13 content"
        },
        "2": {
            "id": "25"
            "content": "child 25 content"
        },
        "3": {
            "id: "75"
            "content": "child 75 content"
        },
        "4": {
            "id": "125"
            "content": "child 125 content"
        }
    }
}
我这样做是为了在这些字段上使用highlight,并在以后轻松找到高亮显示的子项的ID。我使用这样的荧光灯:

"highlight": {
    "order": "score",
    "fields": {
        "name": {
            "number_of_fragments": 0
        },
        "child.*.content": {
        }
    }
}
这种结构会导致很多空字段,一个父项可能有数百个子项,而大多数子项只有一对或没有

我运行了一些测试搜索,突出显示非常慢。然后,我尝试将突出显示的字段限制为测试搜索中的最大字段数。(其中一个结果包含36个孩子,因此我在荧光笔中没有使用“child.*.content”,而是用children 1-36替换了它)。令我惊讶的是,它将搜索时间缩短了10倍。我尝试在突出显示中添加37-72个字段,搜索时间几乎翻了一番

我有点惊讶,高亮显示空字段会花费这么多时间。是否有任何高亮显示方法可以更好地处理稀疏字段?或任何强制高亮显示跳过这些字段的方法(或定义高亮显示如何处理空字段)

我真的想避免使用父/子关系,使用当前结构会容易得多