1 from copy import deepcopy as dc
3 SEARCH_SOURCE_FORMAT = {"index": None, "filter": [],
4 "query": {"language": "lucene", "query": ""}}
10 "query": "query_phrase",
18 def generate(dash_config, viz_config, index_pattern):
20 search_source = dc(SEARCH_SOURCE_FORMAT)
23 filters = dash_config['filter']
24 for _, value in filters.items():
26 temp = dc(FILTER_FORMAT)
27 temp['query']['match'][value['field']
29 temp['query']['match']['placeholder_field']
30 temp['query']['match'][value['field']
31 ]['query'] = value['match-with']
32 del temp['query']['match']['placeholder_field']
33 search_source['filter'].append(temp)
40 filters = viz_config['filter']
41 for _, value in filters.items():
43 temp = dc(FILTER_FORMAT)
44 temp['query']['match'][value['field']
46 temp['query']['match']['placeholder_field']
47 temp['query']['match'][value['field']
48 ]['query'] = value['match-with']
49 del temp['query']['match']['placeholder_field']
50 search_source['filter'].append(temp)
56 search_source['index'] = index_pattern