Tôi chỉ mới bắt đầu với elasticsearch. Yêu cầu của chúng tôi là chúng tôi cần phải lập chỉ mục hàng nghìn tệp PDF và tôi đang gặp khó khăn trong việc chỉ MỘT trong số họ lập chỉ mục thành công.Sai số Elasticsearch Lỗi ngoại lệ khi cố gắng lập chỉ mục PDF
Đã cài đặt plugin Loại tệp đính kèm và nhận phản hồi: Installed mapper-attachments
.
Theo dõi Attachment Type in Action tutorial nhưng quá trình bị treo và Tôi không biết cách diễn giải thông báo lỗi. Cũng đã thử các gist mà treo ở cùng một vị trí.
$ curl -X POST "localhost:9200/test/attachment/" -d json.file
{"error":"ElasticSearchParseException[Failed to derive xcontent from (offset=0, length=9): [106, 115, 111, 110, 46, 102, 105, 108, 101]]","status":400}
Thông tin chi tiết:
Các json.file
chứa một tập tin PDF Base64 nhúng (theo hướng dẫn). Dòng đầu tiên của file xuất hiện đúng (với tôi anyway): {"file":"JVBERi0xLjQNJeLjz9MNCjE1OCAwIG9iaiA8
...
Tôi không chắc chắn nếu có thể là json.file
không hợp lệ hoặc nếu có thể elasticsearch chỉ không được thiết lập để phân tích các file PDF đúng cách? !?
Encoding - Đây là cách chúng ta mã hóa PDF vào json.file
(theo hướng dẫn):
coded=`cat fn6742.pdf | perl -MMIME::Base64 -ne 'print encode_base64($_)'`
json="{\"file\":\"${coded}\"}"
echo "$json" > json.file
cũng đã cố gắng:
coded=`openssl base64 -in fn6742.pdf
log:
[2012-06-07 12:32:16,742][DEBUG][action.index ] [Bailey, Paul] [test][0], node[AHLHFKBWSsuPnTIRVhNcuw], [P], s[STARTED]: Failed to execute [index {[test][attachment][DauMB-vtTIaYGyKD4P8Y_w], source[json.file]}]
org.elasticsearch.ElasticSearchParseException: Failed to derive xcontent from (offset=0, length=9): [106, 115, 111, 110, 46, 102, 105, 108, 101]
at org.elasticsearch.common.xcontent.XContentFactory.xContent(XContentFactory.java:147)
at org.elasticsearch.common.xcontent.XContentHelper.createParser(XContentHelper.java:50)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:451)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:437)
at org.elasticsearch.index.shard.service.InternalIndexShard.prepareCreate(InternalIndexShard.java:290)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:210)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:532)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:430)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Hy vọng ai đó có thể giúp tôi xem những gì tôi đang thiếu hoặc đã làm sai?
Ah, bạn chính xác! Cảm ơn bạn đã giúp đỡ! Nhưng, bây giờ tôi đã thử thêm '@' trước tên tập tin và nó chỉ bị treo mà không có đầu ra cho nhật ký?!? Tôi cần phải * ctrl-C * để lấy lại vỏ. Ý tưởng nào? Có thể một cách để làm cho nhật ký hữu ích hơn? – Meltemi
Bạn có thể chạy jstack và xem nó treo ở đâu không? – imotov
Tôi đã có cùng một sai lầm. Cảm ơn bạn! – ssoto