Skip to content

Search API#

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

SearchApi #

feature_search(
    search_term: str, offset: int = 0, limit: int = 100
) -> search_results.FeatureSearchResult

Search for features.

import hopsworks

project = hopsworks.login()

search_api = project.get_search_api()

result = search_api.feature_search("search_term")

# get feature group instance
feature_group = result.features[0].get_feature_group()

# get feature instance
feature = result.features[0].get_feature()
PARAMETER DESCRIPTION
search_term

The term to search for.

TYPE: str

offset

The number of results to skip.

TYPE: int DEFAULT: 0

limit

The number of search results to return.

TYPE: int DEFAULT: 100

RETURNS DESCRIPTION
search_results.FeatureSearchResult

The matching features from all feature stores in the project including shared feature stores.

RAISES DESCRIPTION
ValueError

If the search term is not provided.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

featuregroup_search(
    search_term: str,
    filter_by: FILTER_BY_ARG = None,
    offset: int = 0,
    limit: int = 100,
) -> search_results.FeatureGroupSearchResult

Search for feature group.

import hopsworks

project = hopsworks.login()

search_api = project.get_search_api()

result = search_api.featuregroup_search("search_term")

# get feature group instance
featuregroup = result.featuregroups[0].get_feature_group()
PARAMETER DESCRIPTION
search_term

The term to search for.

TYPE: str

filter_by

Filter results by a specific field.

TYPE: FILTER_BY_ARG DEFAULT: None

offset

The number of results to skip.

TYPE: int DEFAULT: 0

limit

The number of search results to return.

TYPE: int DEFAULT: 100

RETURNS DESCRIPTION
search_results.FeatureGroupSearchResult

The matching feature groups from all feature stores in the project including shared feature stores.

RAISES DESCRIPTION
ValueError

If the search term is not provided or if the filter_by is not one of the allowed values.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

featurestore_search(
    search_term: str,
    filter_by: FILTER_BY_ARG = None,
    offset: int = 0,
    limit: int = 100,
) -> search_results.FeaturestoreSearchResult

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

import hopsworks

project = hopsworks.login()

search_api = project.get_search_api()

result = search_api.featurestore_search("search-term")

# get feature group instance
featuregroup = result.featuregroups[0].get_feature_group()
PARAMETER DESCRIPTION
search_term

The term to search for.

TYPE: str

filter_by

Filter results by a specific field.

TYPE: FILTER_BY_ARG DEFAULT: None

offset

The number of results to skip.

TYPE: int DEFAULT: 0

limit

The number of search results to return.

TYPE: int DEFAULT: 100

RETURNS DESCRIPTION
search_results.FeaturestoreSearchResult

The matching results from all feature stores in the project including shared feature stores.

RAISES DESCRIPTION
ValueError

If the search term is not provided or if the filter_by is not one of the allowed values.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

featureview_search(
    search_term: str,
    filter_by: FILTER_BY_ARG = None,
    offset: int = 0,
    limit: int = 100,
) -> search_results.FeatureViewSearchResult

Search for feature views.

import hopsworks

project = hopsworks.login()

search_api = project.get_search_api()

result = search_api.featureview_search("search_term")

# get feature view instance
featureview = result.feature_views[0].get_feature_view()
PARAMETER DESCRIPTION
search_term

The term to search for.

TYPE: str

filter_by

Filter results by a specific field (default is None).

TYPE: FILTER_BY_ARG 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

RETURNS DESCRIPTION
search_results.FeatureViewSearchResult

The matching feature views from all feature stores in the project including shared feature stores.

RAISES DESCRIPTION
ValueError

If the search term is not provided or if the filter_by is not one of the allowed values.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

trainingdataset_search(
    search_term: str,
    filter_by: FILTER_BY_ARG = None,
    offset: int = 0,
    limit: int = 100,
) -> search_results.TrainingDatasetSearchResult

Search for training datasets.

import hopsworks

project = hopsworks.login()

search_api = project.get_search_api()

result = search_api.trainingdataset_search("search_term")

# get training datasets instance
trainingdataset = result.trainingdatasets[0].get_training_dataset()
PARAMETER DESCRIPTION
search_term

The term to search for.

TYPE: str

filter_by

Filter results by a specific field.

TYPE: FILTER_BY_ARG DEFAULT: None

offset

The number of results to skip.

TYPE: int DEFAULT: 0

limit

The number of search results to return.

TYPE: int DEFAULT: 100

RETURNS DESCRIPTION
search_results.TrainingDatasetSearchResult

The matching training datasets from all feature stores in the project including shared feature stores.

RAISES DESCRIPTION
ValueError

If the search term is not provided or if the filter_by is not one of the allowed values.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

FeaturestoreSearchResult #

Bases: FeaturestoreSearchResultBase

FeatureGroupSearchResult #

featuregroups property #

featuregroups: list | None

List of FeatureGroupResult.

featuregroups_from property #

featuregroups_from: list | None

Result from offset.

featuregroups_total property #

featuregroups_total: list | None

Total feature groups found.

FeatureViewSearchResult #

feature_views property #

feature_views: list | None

List of FeatureViewResult.

feature_views_from property #

feature_views_from: list | None

Result from offset.

feature_views_total property #

feature_views_total: list | None

Total feature views found.

TrainingDatasetSearchResult #

trainingdatasets property #

trainingdatasets: list | None

List of TrainingDatasetResult.

trainingdatasets_from property #

trainingdatasets_from: list | None

Result from offset.

trainingdatasets_total property #

trainingdatasets_total: list | None

Total training datasets found.

FeatureSearchResult #

features property #

features: list | None

List of FeatureResult.

features_from property #

features_from: list | None

Result from offset.

features_total property #

features_total: list | None

Total features found.

FeatureGroupResult #

Bases: FeaturestoreResult

get_feature_group #

get_feature_group()

Get the feature group instance associated with this feature group result.

RETURNS DESCRIPTION
FeatureGroup

The feature group instance.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

FeatureViewResult #

Bases: FeaturestoreResult

get_feature_view #

get_feature_view()

Get the feature view instance associated with this feature view result.

RETURNS DESCRIPTION
FeatureView

The feature view instance.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

TrainingDatasetResult #

Bases: FeaturestoreResult

get_training_dataset #

get_training_dataset()

Get the training dataset instance associated with this training dataset result.

RETURNS DESCRIPTION
TrainingDataset

The training dataset instance.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

FeatureResult #

Bases: FeaturestoreResult

featuregroup property #

featuregroup: str

Feature group name.

get_feature #

get_feature()

Get the feature instance associated with this feature result.

RETURNS DESCRIPTION
Feature

The feature instance.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

get_feature_group #

get_feature_group()

Get the feature group instance associated with this feature.

RETURNS DESCRIPTION
FeatureGroup

The feature group instance.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.