用Elasticsearch索引openxml结构化文档

问题描述

我们有一组结构化的文档。该结构的灵感来自openxml data model。简而言之,文档由一组有序的段落组成,每个段落本身具有id和一组有序的运行,并且每个运行都有文本内容和一些元数据。

例如,以下示例文档包含两个[“ Lorem i psu m”,“ dolor sit amet”]段落。

{
    id: 1
    paragraphs : [
        {
            title: "De finibus"
            runs: [
                {text: "Lorem i",Metadata: {} },{text: "psu",Metadata: {bold: true} },{text: "m",] 
        },{
            id: 2
            runs: [
                {text: "dolor sit amet",]
}

我们当然希望通过Elasticsearch为文档建立索引,以使其能够回答以下查询

  1. 查询dolor sit

    预期答案:in the document with title="De finibus",in the paragraph with id=2,from the 1th character of the 1s run to the 9th character of the 1rd run

  2. 查询ipsum

    预期答案:in the document with title="De finibus",in the paragraph with id=1,from the 7th character of the 1s run to the 1st character of the 3rd run

  3. 查询ipsum dolor

    预期答案:in the document with title="De finibus",from the 7th character of the 1s run of the paragraph with id=1 to the 5th character of the 1rd run of the paragraph with id=2

我熟悉弹性领域的nested领域。它可能满足第一个查询。但是,我们应该如何映射文档以将连续的行和段落连接在一起,并灵活地回答后面的两个查询

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)