Reading a file in an Elasticsearch plugin

后端 未结 2 658
孤街浪徒
孤街浪徒 2020-12-17 04:14

I am writing an elasticsearch plugin which relies on reading data from a file on disk. When I try to access this file in my code, I get the following exception.



        
2条回答
  •  生来不讨喜
    2020-12-17 05:00

    I had a similar issue in my elasticsearch RestHandler plugin and I was reading the file content from some url say "http://google.com/content.json" I resolved it via below approach -

     `
    String url = "http://google.com/content.json";
    URL fileUrl = new URL(url);
    InputStream is = fileUrl.openStream();
    `
    

提交回复
热议问题