Slow query in python


(Artem Sh) #1

Hello.

I start Elasticsearch in local machine.
Index "wbtm_cities"
Documents: 1.8k
Data: 66.3 MB
Total Shards: 1
Unassigned Shards: 0
Fields:
http://take.ms/0haXq
http://take.ms/am2mS

I do query:
GET wbtm_cities/doc/_search
{
"query": {
"bool": {
"filter": [
{
"term": {
"domain": "site.ru"
}
},
{
"term": {
"is_big": "1"
}
}
]
}
},
"from": 0,
"size": 200,
"_source": {
"includes": [
"name",
"slug",
"declension_rus"
]
}
}

Speed first query in kibana: 7-65 ms - http://take.ms/xNIF1, http://take.ms/YFpue
In second time kibana return 1ms
But then I use Python requests speed low: 200-300ms

1800 document it no many to slow query

  1. Why first Kibana connection is slow?
  2. Why python requests is slow?

(Christian Dahlqvist) #2

Does the time it takes in Python include creating the client and setting up the connection, or is it just the query time?


(Artem Sh) #3

Python client setting up the connection not longer 1-5ms. Then I connect to wikipedia.com this client it's not slow.


(Christian Dahlqvist) #4

OK, so you are not using the official Elasticsearch Python client?


(Artem Sh) #5

I use this library - https://elasticsearch-dsl.readthedocs.io/en/latest/
And I use straight query

the result is the same


(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.