hopsworks.core.search_api #
SearchApi #
Returned by
feature_store #
feature_store(
search_term: str | None = 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: |
keyword_filter | Filter results by keywords. Can be a single string or an array of strings. |
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: TYPE: |
offset | The number of results to skip. TYPE: |
limit | The number of search results to return. TYPE: |
global_search | If TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
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
)
feature_groups #
feature_groups(
search_term: str | None = 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: |
keyword_filter | Filter results by keywords. Can be a single string or an array of strings. |
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: TYPE: |
offset | The number of results to skip. TYPE: |
limit | The number of search results to return. TYPE: |
global_search | If TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
list[FeatureGroupSearchResult] | 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()
feature_views #
feature_views(
search_term: str | None = 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: |
keyword_filter | Filter results by keywords. Can be a single string or an array of strings. |
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: TYPE: |
offset | The number of results to skip. TYPE: |
limit | The number of search results to return. TYPE: |
global_search | If TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
list[FeatureViewSearchResult] | 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()
training_datasets #
training_datasets(
search_term: str | None = 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: |
keyword_filter | Filter results by keywords. Can be a single string or an array of strings. |
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: TYPE: |
offset | The number of results to skip. TYPE: |
limit | The number of search results to return. TYPE: |
global_search | If TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
list[TrainingDatasetSearchResult] | 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()
features #
features(
search_term: str | None = 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: |
keyword_filter | Filter results by keywords. Can be a single string or an array of strings. |
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: TYPE: |
offset | The number of results to skip. TYPE: |
limit | The number of search results to return. TYPE: |
global_search | If TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
list[FeatureSearchResult] | 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}")
TagSearchFilter #
FeatureGroupSearchResult #
Bases: SearchResultItem
Search result for a Feature Group.
get #
get() -> FeatureGroup | None
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 |
|---|---|
FeatureGroup | None | 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. |
FeatureSearchResult #
FeatureViewSearchResult #
Bases: SearchResultItem
Search result for a Feature View.
get #
get() -> FeatureView | None
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 |
|---|---|
FeatureView | None | 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. |
FeaturestoreSearchResult #
Container for all featurestore search results.
Returned by
feature_groups property #
feature_groups: list[FeatureGroupSearchResult]
List of Feature Group search results.
feature_views property #
feature_views: list[FeatureViewSearchResult]
List of Feature View search results.
training_datasets property #
training_datasets: list[TrainingDatasetSearchResult]
List of Training Dataset search results.
feature_groups_offset property #
feature_groups_offset: int
Total offset for the return list of feature groups within the whole result.
feature_views_offset property #
feature_views_offset: int
Total offset for the return list of feature views within the whole result.
training_datasets_offset property #
training_datasets_offset: int
Total offset for the return list of training datasets within the whole result.
features_offset property #
features_offset: int
Total offset for the return list of features within the whole result.
feature_groups_total property #
feature_groups_total: int
Total number of Feature Groups matching the search.
feature_views_total property #
feature_views_total: int
Total number of Feature Views matching the search.
Highlights #
Container for search result highlights showing where matches occurred.
The results are highlighted by wrapping the matched terms in <em> tags. Check the OpenSearch Highlight Queries for more details.
Returned by
description property #
description: str | None
Highlighted description with the matched parts enwrapped in <em> tags.
keywords property #
keywords: list
Highlighted keywords with the matched parts enwrapped in <em> tags.
features property #
features: list
Highlighted features with the matched parts enwrapped in <em> tags.
Project #
Represents a project associated with a search result.
Returned by
SearchResultItem #
TrainingDatasetSearchResult #
Bases: SearchResultItem
Search result for a Training Dataset.
get #
get() -> TrainingDataset | None
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 |
|---|---|
TrainingDataset | None | 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. |