Skip to content

Search API#

You can obtain a SearchApi handle by calling Project.get_search_api.

[source] SearchApi #

[source] feature_groups #

feature_groups(
    search_term: str = None,
    keyword_filter: str | list[str] | None = None,
    tag_filter: dict[str, str]
    | list[dict[str, str] | TagSearchFilter]
    | None = None,
    offset: int = 0,
    limit: int = 100,
    global_search: bool = False,
) -> list[FeatureGroupSearchResult]

Search for feature groups only.

PARAMETER DESCRIPTION
search_term

the term to search for.

TYPE: str DEFAULT: None

keyword_filter

filter results by keywords. Can be a single string or an array of strings.

TYPE: str | list[str] | None DEFAULT: None

tag_filter

filter results by tags. Can be a single dictionary, an array of dictionaries, or an array of TagSearchFilter objects. Each tag filter requires: name (the tag schema name as defined by Hopsworks Admin), key (the property within that tag schema), and value (the value to match).

TYPE: dict[str, str] | list[dict[str, str] | TagSearchFilter] | None DEFAULT: None

offset

the number of results to skip (default is 0).

TYPE: int DEFAULT: 0

limit

the number of search results to return (default is 100).

TYPE: int DEFAULT: 100

global_search

By default is false - search in current project only. Set to true if you want to search over all projects

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
list[FeatureGroupSearchResult]

List: A list of metadata objects for feature groups matching the search criteria.

RAISES DESCRIPTION
`hopsworks.client.exceptions.RestAPIError`

If the backend encounters an error when handling the request

Example:

import hopsworks

project = hopsworks.login()
search_api = project.get_search_api()

# Search for feature groups
fg_metas = search_api.feature_groups("customer")

for fg_meta in fg_metas:
    print(f"Feature Group: {fg_meta.name} v{fg_meta.version}")

    # Get the same FeatureGroup object as returned by featurestore.get_feature_group
    fg = fg_meta.get()

[source] feature_store #

feature_store(
    search_term: str = None,
    keyword_filter: str | list[str] | None = None,
    tag_filter: dict[str, str]
    | list[dict[str, str] | TagSearchFilter]
    | None = None,
    offset: int = 0,
    limit: int = 100,
    global_search: bool = False,
) -> FeaturestoreSearchResult

Search for feature groups, feature views, training datasets and features.

PARAMETER DESCRIPTION
search_term

the term to search for.

TYPE: str DEFAULT: None

keyword_filter

filter results by keywords. Can be a single string or an array of strings.

TYPE: str | list[str] | None DEFAULT: None

tag_filter

filter results by tags. Can be a single dictionary, an array of dictionaries, or an array of TagSearchFilter objects. Each tag filter requires: name (the tag schema name as defined by Hopsworks Admin), key (the property within that tag schema), and value (the value to match).

TYPE: dict[str, str] | list[dict[str, str] | TagSearchFilter] | None DEFAULT: None

offset

the number of results to skip (default is 0).

TYPE: int DEFAULT: 0

limit

the number of search results to return (default is 100).

TYPE: int DEFAULT: 100

global_search

By default is false - search in current project only. Set to true if you want to search over all projects

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
FeaturestoreSearchResult

FeaturestoreSearchResult: The search results containing lists of metadata objects for feature groups, feature views, training datasets, and features.

RAISES DESCRIPTION
`hopsworks.client.exceptions.RestAPIError`

If the backend encounters an error when handling the request

Example:

import hopsworks

project = hopsworks.login()
search_api = project.get_search_api()

# Simple search
result = search_api.feature_store("search-term")

# Access results
for fg_meta in result.feature_groups:
    print(f"Feature Group: {fg_meta.name} v{fg_meta.version}")
    print(f"Description: {fg_meta.description}")
    print(f"Highlights: {fg_meta.highlights}")

    # Get the same FeatureGroup object as returned by featurestore.get_feature_group
    fg = fg_meta.get()

# Search with a single keyword (string)
result = search_api.feature_store("search-term", keyword_filter="ml")

# Search with multiple keywords (array of strings)
result = search_api.feature_store("search-term", keyword_filter=["ml", "production"])

# Search with tag filter as a single dictionary
result = search_api.feature_store(
    "search-term",
    tag_filter={"name": "tag1", "key": "environment", "value": "production"}
)

# Search with tag filter as an array of dictionaries
result = search_api.feature_store(
    "search-term",
    tag_filter=[
        {"name": "tag1", "key": "environment", "value": "production"},
        {"name": "tag2", "key": "version", "value": "v1.0"}
    ]
)

# Search with TagSearchFilter objects
from hopsworks_common.core.search_api import TagSearchFilter
tags = [
    TagSearchFilter(name="tag1", key="environment", value="production"),
    TagSearchFilter(name="tag2", key="version", value="v1.0")
]
result = search_api.feature_store("search-term", tag_filter=tags)

# Search with both keyword_filter and tag_filter
result = search_api.feature_store(
    "search-term",
    keyword_filter=["ml", "production"],
    tag_filter=tags
)

[source] feature_views #

feature_views(
    search_term: str = None,
    keyword_filter: str | list[str] | None = None,
    tag_filter: dict[str, str]
    | list[dict[str, str] | TagSearchFilter]
    | None = None,
    offset: int = 0,
    limit: int = 100,
    global_search: bool = False,
) -> list[FeatureViewSearchResult]

Search for feature views only.

PARAMETER DESCRIPTION
search_term

the term to search for.

TYPE: str DEFAULT: None

keyword_filter

filter results by keywords. Can be a single string or an array of strings.

TYPE: str | list[str] | None DEFAULT: None

tag_filter

filter results by tags. Can be a single dictionary, an array of dictionaries, or an array of TagSearchFilter objects. Each tag filter requires: name (the tag schema name as defined by Hopsworks Admin), key (the property within that tag schema), and value (the value to match).

TYPE: dict[str, str] | list[dict[str, str] | TagSearchFilter] | None DEFAULT: None

offset

the number of results to skip (default is 0).

TYPE: int DEFAULT: 0

limit

the number of search results to return (default is 100).

TYPE: int DEFAULT: 100

global_search

By default is false - search in current project only. Set to true if you want to search over all projects

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
list[FeatureViewSearchResult]

List: A list of metadata objects for feature views matching the search criteria.

RAISES DESCRIPTION
`hopsworks.client.exceptions.RestAPIError`

If the backend encounters an error when handling the request

Example:

import hopsworks

project = hopsworks.login()
search_api = project.get_search_api()

# Search for feature views
fv_metas = search_api.feature_views("customer")

for fv_meta in fv_metas:
    print(f"Feature View: {fv_meta.name} v{fv_meta.version}")

    # Get the same FeatureView object as returned by featurestore.get_feature_view
    fv = fv_meta.get()

[source] features #

features(
    search_term: str = None,
    keyword_filter: str | list[str] | None = None,
    tag_filter: dict[str, str]
    | list[dict[str, str] | TagSearchFilter]
    | None = None,
    offset: int = 0,
    limit: int = 100,
    global_search: bool = False,
) -> list[FeatureSearchResult]

Search for features only.

PARAMETER DESCRIPTION
search_term

the term to search for.

TYPE: str DEFAULT: None

keyword_filter

filter results by keywords. Can be a single string or an array of strings.

TYPE: str | list[str] | None DEFAULT: None

tag_filter

filter results by tags. Can be a single dictionary, an array of dictionaries, or an array of TagSearchFilter objects. Each tag filter requires: name (the tag schema name as defined by Hopsworks Admin), key (the property within that tag schema), and value (the value to match).

TYPE: dict[str, str] | list[dict[str, str] | TagSearchFilter] | None DEFAULT: None

offset

the number of results to skip (default is 0).

TYPE: int DEFAULT: 0

limit

the number of search results to return (default is 100).

TYPE: int DEFAULT: 100

global_search

By default is false - search in current project only. Set to true if you want to search over all projects

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
list[FeatureSearchResult]

List: A list of features matching the search criteria.

RAISES DESCRIPTION
`hopsworks.client.exceptions.RestAPIError`

If the backend encounters an error when handling the request

Example:

import hopsworks

project = hopsworks.login()
search_api = project.get_search_api()

# Search for features
features = search_api.features("age")

for feature in features:
    print(f"Feature: {feature.name}")

[source] training_datasets #

training_datasets(
    search_term: str = None,
    keyword_filter: str | list[str] | None = None,
    tag_filter: dict[str, str]
    | list[dict[str, str] | TagSearchFilter]
    | None = None,
    offset: int = 0,
    limit: int = 100,
    global_search: bool = False,
) -> list[TrainingDatasetSearchResult]

Search for training datasets only.

PARAMETER DESCRIPTION
search_term

the term to search for.

TYPE: str DEFAULT: None

keyword_filter

filter results by keywords. Can be a single string or an array of strings.

TYPE: str | list[str] | None DEFAULT: None

tag_filter

filter results by tags. Can be a single dictionary, an array of dictionaries, or an array of TagSearchFilter objects. Each tag filter requires: name (the tag schema name as defined by Hopsworks Admin), key (the property within that tag schema), and value (the value to match).

TYPE: dict[str, str] | list[dict[str, str] | TagSearchFilter] | None DEFAULT: None

offset

the number of results to skip (default is 0).

TYPE: int DEFAULT: 0

limit

the number of search results to return (default is 100).

TYPE: int DEFAULT: 100

global_search

By default is false - search in current project only. Set to true if you want to search over all projects

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
list[TrainingDatasetSearchResult]

List: A list of metadata objects for training datasets matching the search criteria.

RAISES DESCRIPTION
`hopsworks.client.exceptions.RestAPIError`

If the backend encounters an error when handling the request

Example:

import hopsworks

project = hopsworks.login()
search_api = project.get_search_api()

# Search for training datasets
td_metas = search_api.training_datasets("model")

for td_meta in td_metas:
    print(f"Training Dataset: {td_meta.name} v{td_meta.version}")

    # Get the same TrainingDataset object as returned by featurestore.get_training_dataset
    td = td_meta.get()

[source] FeaturestoreSearchResult #

Container for all featurestore search results.

[source] feature_groups property #

feature_groups: list[FeatureGroupSearchResult]

List of Feature Group search results.

[source] feature_groups_offset property #

feature_groups_offset: int

Total offset for the return list of feature groups within the whole result.

[source] feature_groups_total property #

feature_groups_total: int

Total number of Feature Groups matching the search.

[source] feature_views property #

feature_views: list[FeatureViewSearchResult]

List of Feature View search results.

[source] feature_views_offset property #

feature_views_offset: int

Total offset for the return list of feature views within the whole result.

[source] feature_views_total property #

feature_views_total: int

Total number of Feature Views matching the search.

[source] features property #

List of Feature search results.

[source] features_offset property #

features_offset: int

Total offset for the return list of features within the whole result.

[source] features_total property #

features_total: int

Total number of Features matching the search.

[source] training_datasets property #

training_datasets: list[TrainingDatasetSearchResult]

List of Training Dataset search results.

[source] training_datasets_offset property #

training_datasets_offset: int

Total offset for the return list of training datasets within the whole result.

[source] training_datasets_total property #

training_datasets_total: int

Total number of Training Datasets matching the search.

[source] json #

json() -> dict

Convert to JSON-serializable dictionary.

[source] FeatureGroupSearchResult #

Bases: SearchResultItem

Search result for a Feature Group.

[source] get #

get()

Retrieve the full FeatureGroup object.

This uses the project associated with this search result to obtain a connection to the feature store and then fetches the Feature Group with the given name and version.

RETURNS DESCRIPTION

The full Feature Group object corresponding to this search result.

RAISES DESCRIPTION
Exception

If the connection to the feature store fails or the Feature Group cannot be retrieved.

[source] FeatureViewSearchResult #

Bases: SearchResultItem

Search result for a Feature View.

[source] get #

get()

Retrieve the full FeatureView object.

This uses the project associated with this search result to obtain a connection to the feature store and then fetches the Feature View with the given name and version.

RETURNS DESCRIPTION

The full FeatureView instance corresponding to this search result.

RAISES DESCRIPTION
Exception

If the connection to the feature store fails or the Feature View cannot be retrieved.

[source] TrainingDatasetSearchResult #

Bases: SearchResultItem

Search result for a Training Dataset.

[source] get #

get()

Retrieve the full TrainingDataset object.

This uses the project associated with this search result to obtain a connection to the feature store and then fetches the Training Dataset with the given name and version.

RETURNS DESCRIPTION

The full TrainingDataset instance corresponding to this search result.

RAISES DESCRIPTION
Exception

If the connection to the feature store fails or the Training Dataset cannot be retrieved.

[source] FeatureSearchResult #

Bases: SearchResultItem

Search result for a Feature.