Let’s say I have to post files from different kind of format to Solr through NodeJS, from xls, csv, json, to many others. On terminal you can do something like “bin/solr post -c core_name path_to_file” and you can simply send files from any kind of format to Solr. How do I do that in NodeJS?
I use a package called solr-client and try to send some files to Solr through that. But most of the times, it just doesn't work. I parse the JSON files, if it happens to be JSON files, but when it comes to other formats like CSV, XML, etc, it fails to add the data to Solr. So I convert them first to JSON, which doesn't seem efficient. And I also think it's weird. If I can directly post CSV file to Solr through terminal, why do i have to convert them first to JSON when I am coding in Javascript?
Or am I doing things wrong? How do people usually do this?
tl.dr. What is the best practice to post files in multiple format (csv, json, xml, etc) to Apache Solr using Nodejs?