

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:
        terms['query']['bool']['must'].append({
            'match': {
                '_all': {
                    'query': search_query,
                    'operator': 'and',
                },
            },
        })
    return es_query(params, facets, terms, q)

dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/appstore/views.py es_deployments_query/VarMisuse@130/182 `q`->`terms`