0

In a Zeppelin notebook, running the following query with elasticsearch-py 5x

es = Elasticsearch(["es-host:9200"])
es.search(index="some_index", 
          doc_type="some_type", 
          body={"query": {"term": {"day": "2018_02_04"}}}
)

Takes 28 minutes to return.

From the same notebook, using curl to run:

curl -XGET 'http://es-host:9200/some_index/some_type/_search?pretty' -H 'Content-Type: application/json' -d'
{"query": {"term": {"day": "2018_02_04"}}}
'

returns basically instantly.

Why is the python library performance so poor, and what can be done to make that fast?

4

2 回答 2

1

我不明白为什么会这样,但是如果我filter_path在查询中添加 a ,它会像原始 curl 一样快地返回:

es = Elasticsearch(["es-host:9200"])
results = es.search(index="some_index", 
      doc_type="some_type", 
      filter_path=['hits.hits._id'],
      body={"query": {"term": {"day": "2018_02_04"}}}
)

如果有人对此行为有解释,我将不胜感激。

于 2018-03-23T17:00:48.957 回答
0

这不是我见过的任何东西,根据这个问题判断,我猜你的环境有问题。

于 2018-03-23T16:28:50.123 回答