ElasticSearch:纯文本文件而不是JSON [英] ElasticSearch : plain text file instead of JSON
问题描述
对elasticsearch感兴趣,并使用txt文件而不是json。 Elasticsearch可以支持纯文本文件吗?如果是,是否有任何Java API,我可以使用(我在JSON文档上用邮递员测试了crud操作,并且工作正常)
感谢您的帮助。
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.
推荐答案
否,elasticsearch文档api仅支持JSON。
No, the elasticsearch document api supports only JSON.
但是,使用在集群中的摄取节点上运行的摄取管道可以解决此问题, https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html
。通过默认,每个Elasticsearch服务器实例都是一个摄取节点。
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.
请查看这种针对CSV精心描述的方法 https://www.elastic.co/de/blog/indexing-csv-elasticsearch-ingest-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.
另一种选择是使用第二个工具,如Filebeat或Logstash来提取文件。在这里看看: https://www.elastic.co/products/beats 或在这里 https://www.elastic.co/products/logstash
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
使用Filebeat可以轻松解决许多问题。给它一个机会;)
Having a Filebeat in place will solve many problems with minimal effort. Give it a chance ;)
这篇关于ElasticSearch:纯文本文件而不是JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!