我已經(jīng)安裝了攝取附件處理器,并且正在使用Java代碼從一個(gè)索引讀取文件路徑,documents并在另一個(gè)索引中索引文件內(nèi)容documents_attachment。在此過(guò)程中,如果文件可用,它將解碼為base64并將這些內(nèi)容附加到j(luò)son字段fileContent并在另一個(gè)index中將這些字段索引documents_attachment。如果文件不可用,則嘗試將null值附加到j(luò)son字段,fileContent并嘗試對(duì)這些字段進(jìn)行索引。在此過(guò)程中,當(dāng)我嘗試插入nulljson字段時(shí)遇到以下錯(cuò)誤fileContent。請(qǐng)?jiān)谙旅嬲业藉e(cuò)誤。ElasticsearchStatusException[Elasticsearch exception [type=exception, reason=java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: field [fileContent] is null, cannot parse.]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=java.lang.IllegalArgumentException: field [fileContent] is null, cannot parse.]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=field [fileContent] is null, cannot parse.]]; at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177) at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:573) at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:549) at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:456) at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:429) at org.elasticsearch.client.RestHighLevelClient.index(RestHighLevelClient.java:312) at com.es.utility.DocumentIndex.main(DocumentIndex.java:193) Suppressed: org.elasticsearch.client.ResponseException: method [PUT], host [http://localhost:9200], URI [/document_attachment_dev/doc/129439?pipeline=document_attachment_dev&timeout=1m], status line [HTTP/1.1 500 Internal Server Error]請(qǐng)找到我的Java代碼。
1 回答

白衣非少年
TA貢獻(xiàn)1155條經(jīng)驗(yàn) 獲得超0個(gè)贊
我正在為攝取附件處理器使用以下映射配置,并且在文件內(nèi)容不可用(空)時(shí)它正在工作。
PUT _ingest/pipeline/document_attachment
{
"description" : "my first pipeline with handled exceptions",
"processors" : [
{
"attachment" : {
"field" : "fileContent",
"on_failure" : [
{
"set" : {
"field" : "error",
"value" : "{{ _ingest.on_failure_message }}"
}
}
]
}
}
]
}
添加回答
舉報(bào)
0/150
提交
取消