def es_query_with_analyzer(query, locale):
    analyzer = es_analyzer_for_locale(locale, synonyms=True)
    new_query = {}

    # Import locally to avoid circular import
    from kitsune.search.models import get_mapping_types
    localized_fields = []
    for mt in get_mapping_types():
        localized_fields.extend(mt.get_localized_fields())

    for k, v in query.items():
        field, action = k.split('__')
        if field in localized_fields:
            new_query[k + '_analyzer'] = (v, analyzer)
        else:
            new_query[k] = v

    return new_query
Transform a query dict to use _analyzer actions for the right fields.
dataset/ETHPy150Open mozilla/kitsune/kitsune/search/es_utils.py/es_query_with_analyzer