python elasticsearch使用传输客户端

时间:2016-07-18 11:42:05

标签: python elasticsearch client transport

我是elasticsearch的新手,我知道有两个官方客户端弹性搜索耗材,但是当我使用python elasticsearch时,我找不到如何使用传输客户端..
我阅读了整篇文档,内容如下:

https://elasticsearch-py.readthedocs.io/en/master/index.html

我也搜索了一些文档,我找不到使用elasticsearch的方法python.also,在一个文档中,它说:

  

使用Java之外的任何其他本机协议都不是   建议,因为它需要实现很多自定义   序列化。

这是否意味着python elasticsearch不能使用传输客户端?

2 个答案:

答案 0 :(得分:2)

传输客户端是用Java编写的,因此从Python中使用它的唯一方法是切换到Jython。

答案 1 :(得分:0)

如果这是https://www.iis.net/learn/troubleshoot/performance-issues/troubleshooting-high-cpu-in-an-iis-7x-application-pool,我认为先前的答案已经过期。

我已经使用此API来完成类似the transport client you mean API的操作,该API仍被认为是“实验性”的,因此尚未成为正式客户端。

def rank_eval(self, query, ratings, metric_name):
    res = self.es.transport.perform_request(
        "GET",
        "/%s/_rank_eval" % INDEX,
        body=self.rank_request(query, ratings, metric_name),
    )
    return res