(search_string, default_fields=None)
return {
        query_method: {
            "query": query_string,
            "default_operator": "AND",
            "fields": default_fields if not uses_syntax else None,
        }
    }
Allows users to use advanced query syntax, but if ``search_string`` does
    not use the ES query string syntax, default to doing an infix search for
    each term.  (This may later change to some kind of fuzzy matching).

    This is also available via the main ESQuery class.
Allows users to use advanced query syntax, but if ``search_string`` does
    not use the ES query string syntax, default to doing an infix search for
    each term.  (This may later change to some kind of fuzzy matching).
Allows users to use advanced query syntax but if search_string does not use the ES query string syntax default to doing an infix search for each term . ( This may later change to some kind of fuzzy matching ) .
def search_string_query(search_string, default_fields=None):
    """
    Allows users to use advanced query syntax, but if ``search_string`` does
    not use the ES query string syntax, default to doing an infix search for
    each term.  (This may later change to some kind of fuzzy matching).

    This is also available via the main ESQuery class.
    """
    if not search_string:
        return match_all()

    # use simple_query_string for user-provided syntax, since it won't error
    uses_syntax, query_string = _smart_query_string(search_string)
    query_method = "simple_query_string" if uses_syntax else "query_string"
    return {
        query_method: {
            "query": query_string,
            "default_operator": "AND",
            "fields": default_fields if not uses_syntax else None,
        }
    }
def search_string_query ( search_string , default_fields = None ) : if not search_string : return match_all ( ) # use simple_query_string for user-provided syntax, since it won't error uses_syntax , query_string = _smart_query_string ( search_string ) query_method = "simple_query_string" if uses_syntax else "query_string" return { query_method : { "query" : query_string , "default_operator" : "AND" , "fields" : default_fields if not uses_syntax else None , } }