def es_deployments_query(params, facets=None, terms=None, sort_by='snapshot_time'):
    if (terms is None):
        terms = ['is_approved', 'sort_by', 'search']
    if (facets is None):
        facets = []
    q = {'query': {'bool': {'must': [{'match': {'doc_type': 'Domain'}}, {'term': {'deployment.public': True}}]}}}
    search_query = params.get('search', '')
    if search_query:
        q['query']['bool']['must'].append({'match': {'_all': {'query': search_query, 'operator': 'and'}}})
    return es_query(params, facets, terms, q)
def es_deployments_query(params, facets=None, terms=None, sort_by='snapshot_time'):
    if (terms is None):
        terms = ['is_approved', 'sort_by', 'search']
    if (facets is None):
        facets = []
    q = {'query': {'bool': {'must': [{'match': {'doc_type': 'Domain'}}, {'term': {'deployment.public': True}}]}}}
    search_query = params.get('search', )
    if search_query:
        q['query']['bool']['must'].append({'match': {'_all': {'query': search_query, 'operator': 'and'}}})
    return es_query(params, facets, terms, q)