如果没有index.max_result_window,我可以修复大窗口错误吗?

时间:2016-10-06 05:50:41

标签: elasticsearch

我查了这篇文章:

Elasticsearch 2.1: Result window is too large (index.max_result_window)

但是,我没有'想要改变index.max_result_window设置。

我希望仅通过DSL Query解决此问题。有可能吗?

{'query': {'bool': {'must': [{'match_phrase': {'TABLE_NAME': 'EZ_CALLLIST'}}]}}, 'from': 9200, 'size': 100}
{'query': {'bool': {'must': [{'match_phrase': {'TABLE_NAME': 'EZ_CALLLIST'}}]}}, 'from': 9300, 'size': 100}
{'query': {'bool': {'must': [{'match_phrase': {'TABLE_NAME': 'EZ_CALLLIST'}}]}}, 'from': 9400, 'size': 100}
{'query': {'bool': {'must': [{'match_phrase': {'TABLE_NAME': 'EZ_CALLLIST'}}]}}, 'from': 9500, 'size': 100}
{'query': {'bool': {'must': [{'match_phrase': {'TABLE_NAME': 'EZ_CALLLIST'}}]}}, 'from': 9600, 'size': 100}
{'query': {'bool': {'must': [{'match_phrase': {'TABLE_NAME': 'EZ_CALLLIST'}}]}}, 'from': 9700, 'size': 100}
{'query': {'bool': {'must': [{'match_phrase': {'TABLE_NAME': 'EZ_CALLLIST'}}]}}, 'from': 9800, 'size': 100}
{'query': {'bool': {'must': [{'match_phrase': {'TABLE_NAME': 'EZ_CALLLIST'}}]}}, 'from': 9900, 'size': 100}
{'query': {'bool': {'must': [{'match_phrase': {'TABLE_NAME': 'EZ_CALLLIST'}}]}}, 'from': 10000, 'size': 100}
Traceback (most recent call last):
  File "./dig4time.py", line 53, in <module>
    res = get_es_body(last_cnt, req_unit)
  File "./dig4time.py", line 33, in get_es_body
    res = es.search(index="my_index", body=es_body)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py", line 69, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/__init__.py", line 539, in search
    doc_type, '_search'), params=params, body=body)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py", line 327, in perform_request
    status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.py", line 109, in perform_request
    self._raise_error(response.status, raw_data)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/base.py", line 113, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.TransportError: TransportError(500, u'search_phase_execution_exception', u'Result window is too large, from + size must be less than or equal to: [10000] but was [10100]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level parameter.')

1 个答案:

答案 0 :(得分:0)

这种情况下,你可以使用&#39;滚动&#39; api没有&#39;来自&#39;属性。

但是,如果你想使用&#39;来自&#39;属性,必须设置值小于&#39; max_result_window&#39;值。