ElasticSearch : plain text file instead of JSON

北战南征 提交于 2019-12-11 15:02:55

问题


Interested in elasticsearch and working with txt files not json. Can elasticsearch support plain text file? If yes, Is there any java API, I can use ( I tested crud operations with postman on JSON document and it's working fine ) Thanks for the help.


回答1:


No, the elasticsearch document api supports only JSON.

But there is a workaround for this problem using ingestion pipelines running on ingestion nodes in your cluster https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html . By defaut each elasticsearch server instance is a ingestion node.

Please have a look on this wery well described approach for CSV https://www.elastic.co/de/blog/indexing-csv-elasticsearch-ingest-node which is easily adaptable for flat files.

Another option is to use a second tool like Filebeat or Logstash for file ingestion. Have a look here: https://www.elastic.co/products/beats or here https://www.elastic.co/products/logstash

Having a Filebeat in place will solve many problems with minimal effort. Give it a chance ;)



来源:https://stackoverflow.com/questions/56240963/elasticsearch-plain-text-file-instead-of-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!