упругое исследование с python (kivy) на полях с несколькими совпадениями приводит к тайм-ауту - PullRequest
0 голосов
/ 28 февраля 2020

Я использую API упругого поиска в python (kivy) и сталкиваюсь с проблемой.

Всякий раз, когда я выполняю код и нажимаю кнопку для поиска запроса, я получаю сообщение об ошибке истечения времени ожидания соединения. Я увеличил время ожидания до 120 секунд. Может кто-нибудь помочь, пожалуйста?

Я пытаюсь сопоставить 2 поля, Имя и Возраст, с вводом из текстового поля.

search = es.search(index=INDEX_NAME,
                           doc_type=TYPE_NAME_USER,
                           body={"query":
                                     {"bool":
                                          {"must":
                                               {"multi_match":
                                                    {"query": query,
                                                     "type": "most_fields",
                                                     "fields": ["name", "age"]
                                                     }
                                                }
                                           }
                                      }
                                 },
                           filter_path=['hits.hits._source'],
                           request_timeout=120
                           )

Журнал ниже

C:\Python38\python.exe C:/Users/vinod/PycharmProjects/Run/elasearch.py
[INFO   ] [Logger      ] Record log in C:\Users\vinod\.kivy\logs\kivy_20-02-29_16.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.1.18
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.2.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.2.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.2.0
[INFO   ] [Kivy        ] v2.0.0rc1, git-ae0fa0c, 20191229
[INFO   ] [Kivy        ] Installed at "C:\Python38\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Python38\python.exe"
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'4.5.0 - Build 25.20.100.6519'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel'>
[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) UHD Graphics 620'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 5
[INFO   ] [GL          ] Shading version <b'4.50 - Build 25.20.100.6519'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [GL          ] NPOT texture support is available
[INFO   ] [Base        ] Start application main loop
[INFO   ] [Base        ] Leaving application in progress...
 Traceback (most recent call last):
   File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request
     six.raise_from(e, None)
   File "<string>", line 3, in raise_from
   File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request
     httplib_response = conn.getresponse()
   File "C:\Python38\lib\http\client.py", line 1322, in getresponse
     response.begin()
   File "C:\Python38\lib\http\client.py", line 303, in begin
     version, status, reason = self._read_status()
   File "C:\Python38\lib\http\client.py", line 264, in _read_status
     line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
   File "C:\Python38\lib\socket.py", line 669, in readinto
     return self._sock.recv_into(b)
 socket.timeout: timed out

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "C:\Python38\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 241, in perform_request
     response = self.pool.urlopen(
   File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 719, in urlopen
     retries = retries.increment(
   File "C:\Python38\lib\site-packages\urllib3\util\retry.py", line 376, in increment
     raise six.reraise(type(error), error, _stacktrace)
   File "C:\Python38\lib\site-packages\urllib3\packages\six.py", line 735, in reraise
     raise value
   File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 665, in urlopen
     httplib_response = self._make_request(
   File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 423, in _make_request
     self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
   File "C:\Python38\lib\site-packages\urllib3\connectionpool.py", line 330, in _raise_timeout
     raise ReadTimeoutError(
 urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='127.0.0.1', port=9200): Read timed out. (read timeout=120)

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "C:/Users/vinod/PycharmProjects/Run/elasearch.py", line 102, in <module>
     ElasticApp().run()
   File "C:\Python38\lib\site-packages\kivy\app.py", line 950, in run
     runTouchApp()
   File "C:\Python38\lib\site-packages\kivy\base.py", line 560, in runTouchApp
     EventLoop.mainloop()
   File "C:\Python38\lib\site-packages\kivy\base.py", line 334, in mainloop
     self.idle()
   File "C:\Python38\lib\site-packages\kivy\base.py", line 378, in idle
     self.dispatch_input()
   File "C:\Python38\lib\site-packages\kivy\base.py", line 329, in dispatch_input
     post_dispatch_input(*pop(0))
   File "C:\Python38\lib\site-packages\kivy\base.py", line 235, in post_dispatch_input
     listener.dispatch('on_motion', etype, me)
   File "kivy\_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
   File "C:\Python38\lib\site-packages\kivy\core\window\__init__.py", line 1407, in on_motion
     self.dispatch('on_touch_down', me)
   File "kivy\_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
   File "C:\Python38\lib\site-packages\kivy\core\window\__init__.py", line 1423, in on_touch_down
     if w.dispatch('on_touch_down', touch):
   File "kivy\_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
   File "C:\Python38\lib\site-packages\kivy\uix\widget.py", line 545, in on_touch_down
     if child.dispatch('on_touch_down', touch):
   File "kivy\_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
   File "C:\Python38\lib\site-packages\kivy\uix\behaviors\button.py", line 151, in on_touch_down
     self.dispatch('on_press')
   File "kivy\_event.pyx", line 705, in kivy._event.EventDispatcher.dispatch
   File "kivy\_event.pyx", line 1248, in kivy._event.EventObservers.dispatch
   File "kivy\_event.pyx", line 1172, in kivy._event.EventObservers._dispatch
   File "C:/Users/vinod/PycharmProjects/Run/elasearch.py", line 71, in update
     search = es.search(index=INDEX_NAME,
   File "C:\Python38\lib\site-packages\elasticsearch\client\utils.py", line 84, in _wrapped
     return func(*args, params=params, **kwargs)
   File "C:\Python38\lib\site-packages\elasticsearch\client\__init__.py", line 1547, in search
     return self.transport.perform_request(
   File "C:\Python38\lib\site-packages\elasticsearch\transport.py", line 351, in perform_request
     status, headers_response, data = connection.perform_request(
   File "C:\Python38\lib\site-packages\elasticsearch\connection\http_urllib3.py", line 253, in perform_request
     raise ConnectionTimeout("TIMEOUT", str(e), e)
 elasticsearch.exceptions.ConnectionTimeout: ConnectionTimeout caused by - ReadTimeoutError(HTTPConnectionPool(host='127.0.0.1', port=9200): Read timed out. (read timeout=120))

Process finished with exit code 1
...