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
Elasticsearch 文档附件处理与文本抽取

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

被折叠的 条评论
为什么被折叠?



