简体   繁体   English

通过WEB API在ElasticSearch中建立索引数据

[英]Index data in ElasticSearch from a WEB API

Im trying to index / insert data from an API of a service called PRTG into elasticsearch. 我正在尝试从名为PRTG的服务的API索引数据/将数据插入Elasticsearch。 This API when i go to an specific URL returns a JSON file, like an WEB API, without downloading nothing. 当我转到特定的URL时,此API返回JSON文件(如WEB API),而不下载任何内容。 I thought it was possible with this command: 我认为可以使用以下命令:

curl --user elastic:****** -XPOST http://localhost:9200/prtg_test/_mapping/_doc  -d @'https://prtgserver/api/historicdata.json?id=2477&avg=0&sdate=2018-08-01-00-00-00&edate=2018-08-07-00-00-00&usecaption=1&username=myusser&password=****'

But im getting an error. 但是,我得到一个错误。

Im newbie in Elastic, so any help would be great, thanks. 我是Elastic的新手,谢谢您的任何帮助。

To input and index your data in elasticsearch, you first need an input in Logstash. 要在elasticsearch中输入数据并建立索引,首先需要在Logstash中输入。

Logstash consumes and cleans the data, elasticsearch stores, indexes and presents the data (via web page). Logstash消耗并清除数据,elasticsearch存储,索引并显示数据(通过网页)。

快速而肮脏的图

Logstash has an input plugin you could use to consume your messages. Logstash有一个输入插件,您可以使用它来消耗消息。 Here are details. 这是详细信息。 You'd setup the url as an input and send the data to elasticsearch. 您将把URL设置为输入并将数据发送到elasticsearch。 You should review the grok language to parse and clean your data in an elasticsearch readable format. 您应该查看grok语言,以便以Elasticsearch可读格式解析和清理数据。

http plugin http插件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM