Fix API report requests when using opensearch
Change-Id: I68a5297ab71c616856230000f1718ff72d25883d
(cherry picked from commit 03d508b746
)
This commit is contained in:
parent
7197677daf
commit
e4164241a3
@ -98,14 +98,15 @@ class OpenSearchClient(object):
|
|||||||
sources = []
|
sources = []
|
||||||
for elem in groupby:
|
for elem in groupby:
|
||||||
if elem == 'type':
|
if elem == 'type':
|
||||||
sources.append({'type': {'terms': {'field': 'type'}}})
|
sources.append({'type': {'terms': {'field': 'type.keyword'}}})
|
||||||
elif elem == 'time':
|
elif elem == 'time':
|
||||||
# Not doing a date_histogram aggregation because we don't know
|
# Not doing a date_histogram aggregation because we don't know
|
||||||
# the period
|
# the period
|
||||||
sources.append({'begin': {'terms': {'field': 'start'}}})
|
sources.append({'begin': {'terms': {'field': 'start'}}})
|
||||||
sources.append({'end': {'terms': {'field': 'end'}}})
|
sources.append({'end': {'terms': {'field': 'end'}}})
|
||||||
else:
|
else:
|
||||||
sources.append({elem: {'terms': {'field': 'groupby.' + elem}}})
|
field = 'groupby.' + elem + '.keyword'
|
||||||
|
sources.append({elem: {'terms': {'field': field}}})
|
||||||
|
|
||||||
return {"sources": sources}
|
return {"sources": sources}
|
||||||
|
|
||||||
|
@ -86,9 +86,9 @@ class TestOpenSearchClient(unittest.TestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.client._build_composite(['one', 'type', 'two']),
|
self.client._build_composite(['one', 'type', 'two']),
|
||||||
{'sources': [
|
{'sources': [
|
||||||
{'one': {'terms': {'field': 'groupby.one'}}},
|
{'one': {'terms': {'field': 'groupby.one.keyword'}}},
|
||||||
{'type': {'terms': {'field': 'type'}}},
|
{'type': {'terms': {'field': 'type.keyword'}}},
|
||||||
{'two': {'terms': {'field': 'groupby.two'}}},
|
{'two': {'terms': {'field': 'groupby.two.keyword'}}},
|
||||||
]},
|
]},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fix some API report requests that were returning HTTP 500 errors when using
|
||||||
|
the ``opensearch`` storage backend. This fixes failures to load the Horizon
|
||||||
|
``Rating`` panel.
|
Loading…
Reference in New Issue
Block a user