【问题标题】:Is is possible to index data into Elastic Search without using Logstash or FileBeats or Kibana?是否可以在不使用 Logstash 或 FileBeats 或 Kibana 的情况下将数据索引到 Elastic Search 中?
【发布时间】:2021-07-28 17:23:51
【问题描述】:

弹性搜索对我来说是新的。我想知道是否可以仅使用 ES 框架将数据索引到 Elastic Search 中? (不使用其堆栈成员,如 Logstash、FileBeats、Kibana 等)

【问题讨论】:

    标签: elasticsearch logstash kibana elastic-stack filebeat


    【解决方案1】:

    您可以在终端中使用 curl 命令。一些著名的

    用于删除索引

    curl -X DELETE 'http://localhost:9200/samples'

    用于列出所有索引

    curl -X GET 'http://localhost:9200/_cat/indices?v'

    用于将文档添加到索引

    curl -XPUT --header 'Content-Type: application/json' http://localhost:9200/samples/_doc/1 -d '{
       "school" : "Harvard"         
    }'

    用于批量加载 JSON 格式的数据

    export pwd="elastic:"
    
    curl --user $pwd  -H 'Content-Type: application/x-ndjson' -XPOST 'https://58571402f5464923883e7be42a037917.eu-central-1.aws.cloud.es.io:9243/0/_bulk?pretty' --data-binary @<file>

    用于显示集群运行状况

    curl --user $pwd  -H 'Content-Type: application/json' -XGET https://58571402f5464923883e7be42a037917.eu-central-1.aws.cloud.es.io:9243/_cluster/health?pretty

    用于查询和返回一些需要的字段

    GET filebeat-7.6.2-2020.05.05-000001/_search
     {
        "_source": ["suricata.eve.timestamp","source.geo.region_name","event.created"],
        "query":      {
            "match" : { "source.geo.country_iso_code": "GR" }
        }
    }

    您可以在Here 上找到更多信息。

    【讨论】:

      【解决方案2】:

      是的!大时代。

      您可以使用大量工具和大量 SDK,或者您可以使用自己的生产者来使用索引 API。

      这里有几个例子:

      Elastic 发布了 officially supported clientscommunity supported clients 的列表,但它们对编程语言很重,并且不包括 Fluentd 输出、Kafka 连接器等内容。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-08-01
        • 2017-08-30
        • 1970-01-01
        • 2021-08-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多