Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too long frame exception2 #137

Merged
merged 8 commits into from
Feb 28, 2020
29 changes: 14 additions & 15 deletions eland/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,17 @@ def _es_results(self, query_compiler, collector):

# Only return requested field_names
_source = query_compiler.get_field_names(include_scripted_fields=False)
if not _source:
if _source:
# For query_compiler._client.search we could add _source
# as a parameter, or add this value in body.
#
# If _source is a parameter it is encoded into to the url.
#
# If _source is a large number of fields (1000+) then this can result in an
# extremely long url and a `too_long_frame_exception`. Therefore, add
# _source to the body rather than as a _source parameter
body['_source'] = _source
else:
_source = False

es_results = None
Expand All @@ -602,16 +612,7 @@ def _es_results(self, query_compiler, collector):
if size is not None and size <= DEFAULT_ES_MAX_RESULT_WINDOW:
if size > 0:
try:
# For query_compiler._client.search we could add _source
# as a parameter, or add this value in body.
#
# If _source is a parameter it is encoded into to the url.
#
# If _source is a large number of fields (1000+) then this can result in an
# extremely long url and a `too_long_frame_exception`. Therefore, add
# _source to the body rather than as a _source parameter
if _source:
body['_source'] = _source


es_results = query_compiler._client.search(
index=query_compiler._index_pattern,
Expand All @@ -624,17 +625,15 @@ def _es_results(self, query_compiler, collector):
'index': query_compiler._index_pattern,
'size': size,
'sort': sort_params,
'body': body,
'_source': _source
'body': body
}
print("Elasticsearch error:", error)
raise
else:
is_scan = True
es_results = query_compiler._client.scan(
index=query_compiler._index_pattern,
query=body,
_source=_source)
query=body)
# create post sort
if sort_params is not None:
post_processing.append(SortFieldAction(sort_params))
Expand Down