2017-02-17 35 views

回答

1

只需发送Base64编码的PDF在一个领域,如:

String base64; 
try (InputStream is = YourClass.class.getResourceAsStream(pathToYourFile)) { 
    byte bytes[] = IOUtils.toByteArray(is); 
    base64 = Base64.getEncoder().encodeToString(bytes); 
} 

IndexRequest indexRequest = new IndexRequest("index", "type", "id") 
    .setPipeline("foo") 
    .source(
     jsonBuilder().startObject() 
      .field("field", base64) 
     .endObject() 
    ); 

如果你没有意识到这一点,我也链接到FSCrawler project的情况下,它解决了你想已经做一些事情。

0

这里是你可以用它来索引PDF文件到ElasticSearch

  • 摄取附件插件
  • 的Apache提卡
  • FsCrawler
  • 安巴尔描述

优点/缺点四个选项this post

相关问题