Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.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
Php 如何将以后可以检索到的文档页面索引到elasticsearch中_Php_Arrays_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch,Php,Arrays,elasticsearch" /> elasticsearch,Php,Arrays,elasticsearch" />

Php 如何将以后可以检索到的文档页面索引到elasticsearch中

Php 如何将以后可以检索到的文档页面索引到elasticsearch中,php,arrays,elasticsearch,Php,Arrays,elasticsearch,我在elasticsearch中索引PDF文档而不使用官方插件,我使用PHP库将PDF内容解析为纯文本。这个PHP库允许我按页面获取文档内容,因此我希望我的搜索页面能够检索到一些类似以下内容的突出显示: [第1页]。。。从搜索中突出显示的文本。。。[第4页]。。。第4页中与搜索匹配的突出显示文本 他们给我的映射是这样的,我只是将文本从字符串转换为数组: properties: { highlight:{ text: [ "Page1Content...", "Page

我在elasticsearch中索引PDF文档而不使用官方插件,我使用PHP库将PDF内容解析为纯文本。这个PHP库允许我按页面获取文档内容,因此我希望我的搜索页面能够检索到一些类似以下内容的突出显示:

[第1页]。。。从搜索中突出显示的文本。。。[第4页]。。。第4页中与搜索匹配的突出显示文本

他们给我的映射是这样的,我只是将文本从字符串转换为数组:

properties: {

    highlight:{

        text: [ "Page1Content...", "Page2Content...", "Page3Content...", ...],

        other_fields: {}

    },

    other_fields: {}
}
但是在获取突出显示的内容时,我找不到一种获取数组索引的方法,它会在获取过程中丢失

当我搜索时,嵌套/对象是知道页码的唯一方法吗?我不知道在高亮显示时数组键是否丢失。我这样想:

highlight : {

    text: {
            "Page1" : "Page1Content",
            "Page2": "Page2Content",
            ....
          },
    other_fields: {}
}

提前感谢。

乍一看,我会将每页内容编入自己的文档,文档中也会包含页码作为字段。这样一来,1)您可以保持文档的小型化,2)您不需要处理数组和嵌套内容,3)荧光笔可以在box@Val但是,如果禁用源代码,在突出显示文本字段时如何获取页面字段?乍一看,我会将每个页面内容索引到自己的文档中,其中还包括页码作为字段。这样一来,1)您可以保持文档的小型化,2)您不需要处理数组和嵌套内容,3)荧光笔可以在box@Val但是,如果禁用_源代码,在突出显示文本字段时如何获取页面字段?