我是Elasticsearch的新手。我已经用Kibana,X-pack和摄入附件成功安装了Elasticsearch。我同时运行Elasticsearch和Kibana。我现在在使用Windows 2012服务器上的默认选项进行安装时保持了简单。我在另一个驱动器w\mydocs
上有一个目录,目前它只有3个纯文本文件,但我想要添加其他类似pdf和doc文件类型的文件。所以现在我想把这些文件放到Elasticsearches索引中。我已经尝试使用以下链接作为指导Attaching pdf docs in Elasticsearch,但是我无法使其工作。如何使用elasticsearch索引文件5.5.1
下面是我已经建立了索引和管道:
PUT _ingest/pipeline/docs
{
"description": "documents",
"processors" : [
{
"attachment" : {
"field": "data",
"indexed_chars" : -1
}
}]
}
PUT myindex
{
"mappings" : {
"documents" : {
"properties" : {
"attachment.data" : {
"type": "text",
"analyzer": "standard"
}
}
}
}
}
然后拿到第一文档中我使用以下命令: PUT localhost:9200/documents/1?pipeline=docs -d @/w/mydocs/README.TXT
和我收到的错误是:
{
"error": {
"root_cause": [
{
"type": "parse_exception",
"reason": "request body is required"
}
],
"type": "parse_exception",
"reason": "request body is required"
},
"status": 400
}
所以现在如果我把以下内容:'PUT本地主机:9200 /文件/ 1 =管道文档 ?{ “数据”: “BASE64_ENCODE( 'W:\\ \\ myDocs README.TXT')” } '我收到非法的base64字符5f参数异常 – bilpor
您需要将文件内容转换为客户端上的base64,然后将该字符串作为数据字段发送。只需指定路径不起作用。 – alr