Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions api/handlers/dataexplorerhandler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import copy
import json

from elasticsearch import ElasticsearchException, TransportError, helpers
from elasticsearch import ElasticsearchException, TransportError, RequestError, helpers

from ..web import base
from .. import config
Expand Down Expand Up @@ -372,6 +372,10 @@ def _parse_request(self, request_type='search'):

else:
modified_filters.append({'terms': {k+'.raw': v}})
elif f.get('term'):
# Search raw field
for k,v in f['term'].iteritems():
modified_filters.append({'term': {k+'.raw': v}})
else:
modified_filters.append(f)

Expand Down Expand Up @@ -687,11 +691,14 @@ def _construct_exact_query(self, return_type, search_string, filters, size=100):
## RUNNING QUERIES AND PROCESSING RESULTS ##

def _run_query(self, es_query, result_type):
results = config.es.search(
index='data_explorer',
doc_type='flywheel',
body=es_query
)
try:
results = config.es.search(
index='data_explorer',
doc_type='flywheel',
body=es_query
)
except RequestError:
self.abort(400, 'Unable to parse filters - invalid format.')

return self._process_results(results, result_type)

Expand Down