使用Elasticsearch 7.9.1实现对word,pdf,txt文件的全文内容检索

Elasticsearch 文档附件处理与文本抽取
这篇博客介绍了如何在Elasticsearch中安装和配置ingest-attachment插件,用于处理文档附件并抽取文本。首先,通过命令行安装了分词插件和attachment插件。接着,定义了一个文本抽取管道,指定从content字段提取信息。然后,创建了文档结构映射,包括id、name、type字段,并设置了attachment字段,使用ik_smart分析器对content字段进行分词。最后,说明了如何将文件base64编码后上传到Elasticsearch。

1.安装插件

#预处理
./bin/elasticsearch-plugin install ingest-attachment
#分词
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/...这里找你的版本

2.定义文本抽取管道

PUT /_ingest/pipeline/attachment
{
    "description": "Extract attachment information",
    "processors": [
        {
            "attachment": {
                "field": "content",
                "ignore_missing": true
            }
        },
        {
            "remove": {
                "field": "content"
            }
        }
    ]
}

在attachment中指定要过滤的字段为content,所以写入Elasticsearch时需要将文档内容放在content字段

3.建立文档结构映射

PUT /docwrite
{
  "mappings": {
    "properties": {
      "id":{
        "typ
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

梁晓山(ben)

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值