简体   繁体   English

Excel到ElasticSearch API请求

[英]Excel to ElasticSearch API Requests

I searched the internet and could not find good examples. 我在互联网上搜索,找不到很好的例子。 I am new to ES and programming as well. 我是ES和编程的新手。

I am trying to connect directly from Excel to ElasticSearch cluster.. I am trying to write the API request in its entirety. 我正在尝试直接从Excel连接到ElasticSearch集群。我正在尝试完整编写API请求。 I have tried a few things.. need some more help here. 我已经尝试了一些方法..在这里需要更多帮助。 Here is what, I was able to do. 这就是我所能做的。

Sub MyFirstRESTAPICALL()
    Dim oRequest As Object
    Set oRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
    oRequest.Open "GET", "http://my-es-node1:9200"
    MsgBox oRequest.ResponseText
End Sub

I get a simple response in my excel, but I need to do more. 我在excel中得到一个简单的响应,但是我需要做更多的事情。

How do I construct GET request that can be used from Excel to ElasticSearch? 如何构造可用于Excel到ElasticSearch的GET请求? The query I am using in kibana is below. 我在kibana中使用的查询如下。 I need to translate it and update the GET request above. 我需要翻译它并更新上面的GET请求。

GET DJ_cust_latest/cust/_search?size=100 {
    "_source":["cust-_info-_version", "cust-config-num", "num_tables"], 
    "query":{
        "bool":{
            "must":[
                {"terms":
                    {"cust_uuid":[
                        "00845916-3245-dcbf-0000-87650000d98c",
                        "00634297-1718-f280-0000-00000897e522"]
                    }
                }
            ]
        }
    }
}

After reading the docs and understanding the query string syntax a little more better, I reached the conclusion that querying ElasticSearch (ES) from Excel is not only a nightmare (writing the query string syntax etc..) but also very inefficient as parsing the Json output will also be painful. 阅读文档并更好地了解查询字符串语法后,我得出的结论是,从Excel查询ElasticSearch(ES)不仅是一场噩梦(编写查询字符串语法等),而且解析Json的效率非常低输出也会很痛苦。 So, I am planning to do the ES in Shell scripts, getting raw Json data, create CSV's and then process it in Excel. 因此,我计划在Shell脚本中执行ES,获取原始Json数据,创建CSV,然后在Excel中进行处理。

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

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