eland.DataFrame.es_match#
- DataFrame.es_match(text: str, *, columns: Optional[Union[str, Sequence[str]]] = None, match_phrase: bool = False, must_not_match: bool = False, multi_match_type: Optional[str] = None, match_only_text_fields: bool = True, analyzer: Optional[str] = None, fuzziness: Optional[Union[int, str]] = None, **kwargs: Any) DataFrame #
Filters data with an Elasticsearch
match
,match_phrase
, ormulti_match
query depending on the given parameters and columns.Read more about Full-Text Queries in Elasticsearch
By default all fields of type ‘text’ within Elasticsearch are queried otherwise specific columns can be specified via the
columns
parameter or a single column can be filtered on witheland.Series.es_match()
All additional keyword arguments are passed in the body of the match query.
Parameters#
- text: str
String of text to search for
- columns: str, List[str], optional
List of columns to search over. Defaults to all ‘text’ fields in Elasticsearch
- match_phrase: bool, default False
If True will use
match_phrase
instead ofmatch
query which takes into account the order of thetext
parameter.- must_not_match: bool, default False
If True will apply a boolean NOT (~) to the query. Instead of requiring a match the query will require text to not match.
- multi_match_type: str, optional
If given and matching against multiple columns will set the
multi_match.type
setting- match_only_text_fields: bool, default True
When True this function will raise an error if any non-text fields are queried to prevent fields that aren’t analyzed from not working properly. Set to False to ignore this preventative check.
- analyzer: str, optional
Specify which analyzer to use for the match query
- fuzziness: int, str, optional
Specify the fuzziness option for the match query
Returns#
- DataFrame
A filtered
eland.DataFrame
with the given match query
Examples#
>>> df = ed.DataFrame("http://localhost:9200", "ecommerce") >>> df.es_match("Men's", columns=["category"]) category currency ... type user 0 [Men's Clothing] EUR ... order eddie 4 [Men's Clothing, Men's Accessories] EUR ... order eddie 6 [Men's Clothing] EUR ... order oliver 7 [Men's Clothing, Men's Accessories, Men's Shoes] EUR ... order abd 11 [Men's Accessories, Men's Clothing] EUR ... order eddie ... ... ... ... ... ... 4663 [Men's Shoes, Men's Clothing] EUR ... order samir 4667 [Men's Clothing, Men's Shoes] EUR ... order sultan 4671 [Men's Clothing] EUR ... order jim 4672 [Men's Clothing] EUR ... order yahya 4674 [Women's Accessories, Men's Clothing] EUR ... order jackson [2310 rows x 45 columns]