Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion sdk/search/azure-search-documents/_metadata.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"apiVersion": "2025-11-01-preview"
"apiVersion": "2025-11-01-preview",
"apiVersions": {
"Search": "2025-11-01-preview"
}
}
5 changes: 3 additions & 2 deletions sdk/search/azure-search-documents/apiview-properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
"azure.search.documents.indexes.models.SearchIndexKnowledgeSource": "Search.SearchIndexKnowledgeSource",
"azure.search.documents.indexes.models.SearchIndexKnowledgeSourceParameters": "Search.SearchIndexKnowledgeSourceParameters",
"azure.search.documents.knowledgebases.models.SearchIndexKnowledgeSourceParams": "Search.SearchIndexKnowledgeSourceParams",
"azure.search.documents.indexes.models.SearchIndexResponse": "Search.SearchIndexResponse",
"azure.search.documents.models.SearchRequest": "Search.SearchRequest",
"azure.search.documents.indexes.models.SearchResourceEncryptionKey": "Search.SearchResourceEncryptionKey",
"azure.search.documents.models.SearchResult": "Search.SearchResult",
Expand Down Expand Up @@ -396,8 +397,8 @@
"azure.search.documents.aio.SearchIndexClient.create_synonym_map": "Customizations.SearchIndexClient.SynonymMaps.create",
"azure.search.documents.SearchIndexClient.get_index": "Customizations.SearchIndexClient.Indexes.get",
"azure.search.documents.aio.SearchIndexClient.get_index": "Customizations.SearchIndexClient.Indexes.get",
"azure.search.documents.SearchIndexClient.list_indexes": "Customizations.SearchIndexClient.Indexes.list",
"azure.search.documents.aio.SearchIndexClient.list_indexes": "Customizations.SearchIndexClient.Indexes.list",
"azure.search.documents.SearchIndexClient.list_indexes_with_selected_properties": "Customizations.SearchIndexClient.Indexes.listWithSelectedProperties",
"azure.search.documents.aio.SearchIndexClient.list_indexes_with_selected_properties": "Customizations.SearchIndexClient.Indexes.listWithSelectedProperties",
"azure.search.documents.SearchIndexClient.create_index": "Customizations.SearchIndexClient.Indexes.create",
"azure.search.documents.aio.SearchIndexClient.create_index": "Customizations.SearchIndexClient.Indexes.create",
"azure.search.documents.SearchIndexClient.get_alias": "Customizations.SearchIndexClient.Aliases.get",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class SearchClient(_SearchClientOperationsMixin):
~azure.core.credentials.TokenCredential
:param index_name: The name of the index. Required.
:type index_name: str
:keyword api_version: The API version to use for this operation. Default value is
"2025-11-01-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Known values are
"2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes
~azure.core.credentials.TokenCredential
:param index_name: The name of the index. Required.
:type index_name: str
:keyword api_version: The API version to use for this operation. Default value is
"2025-11-01-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Known values are
"2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class SearchClient(_SearchClientOperationsMixin):
~azure.core.credentials_async.AsyncTokenCredential
:param index_name: The name of the index. Required.
:type index_name: str
:keyword api_version: The API version to use for this operation. Default value is
"2025-11-01-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Known values are
"2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes
~azure.core.credentials_async.AsyncTokenCredential
:param index_name: The name of the index. Required.
:type index_name: str
:keyword api_version: The API version to use for this operation. Default value is
"2025-11-01-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Known values are
"2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin):
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2025-11-01-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Known values are
"2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down Expand Up @@ -111,9 +111,9 @@ class SearchIndexerClient(_SearchIndexerClientOperationsMixin):
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2025-11-01-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Known values are
"2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2025-11-01-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Known values are
"2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down Expand Up @@ -84,9 +84,9 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2025-11-01-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Known values are
"2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,28 @@ def build_search_index_get_index_request(name: str, **kwargs: Any) -> HttpReques
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)


def build_search_index_list_indexes_request(*, select: Optional[list[str]] = None, **kwargs: Any) -> HttpRequest:
def build_search_index_list_indexes_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview"))
accept = _headers.pop("Accept", "application/json;odata.metadata=minimal")

# Construct URL
_url = "/indexes"

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")

# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")

return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)


def build_search_index_list_indexes_with_selected_properties_request( # pylint: disable=name-too-long
*, select: Optional[list[str]] = None, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

Expand Down Expand Up @@ -2210,13 +2231,9 @@ def get_index(self, name: str, **kwargs: Any) -> _models1.SearchIndex:
return deserialized # type: ignore

@distributed_trace
def list_indexes(self, *, select: Optional[list[str]] = None, **kwargs: Any) -> ItemPaged["_models1.SearchIndex"]:
def _list_indexes(self, **kwargs: Any) -> ItemPaged["_models1.SearchIndex"]:
"""Lists all indexes available for a search service.

:keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated
list of JSON property names, or '*' for all properties. The default is all properties. Default
value is None.
:paramtype select: list[str]
:return: An iterator like instance of SearchIndex
:rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndex]
:raises ~azure.core.exceptions.HttpResponseError:
Expand All @@ -2238,7 +2255,6 @@ def prepare_request(next_link=None):
if not next_link:

_request = build_search_index_list_indexes_request(
select=select,
api_version=self._config.api_version,
headers=_headers,
params=_params,
Expand Down Expand Up @@ -2300,6 +2316,100 @@ def get_next(next_link=None):

return ItemPaged(get_next, extract_data)

@distributed_trace
def _list_indexes_with_selected_properties(
self, *, select: Optional[list[str]] = None, **kwargs: Any
) -> ItemPaged["_models1._models.SearchIndexResponse"]:
"""Lists all indexes available for a search service.

:keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated
list of JSON property names, or '*' for all properties. The default is all properties. Default
value is None.
:paramtype select: list[str]
:return: An iterator like instance of SearchIndexResponse
:rtype:
~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models._models.SearchIndexResponse]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}

cls: ClsType[list[_models1._models.SearchIndexResponse]] = kwargs.pop("cls", None)

error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

def prepare_request(next_link=None):
if not next_link:

_request = build_search_index_list_indexes_with_selected_properties_request(
select=select,
api_version=self._config.api_version,
headers=_headers,
params=_params,
)
path_format_arguments = {
"endpoint": self._serialize.url(
"self._config.endpoint", self._config.endpoint, "str", skip_quote=True
),
}
_request.url = self._client.format_url(_request.url, **path_format_arguments)

else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
path_format_arguments = {
"endpoint": self._serialize.url(
"self._config.endpoint", self._config.endpoint, "str", skip_quote=True
),
}
_request.url = self._client.format_url(_request.url, **path_format_arguments)

return _request

def extract_data(pipeline_response):
deserialized = pipeline_response.http_response.json()
list_of_elem = _deserialize(list[_models1._models.SearchIndexResponse], deserialized.get("value", []))
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return None, iter(list_of_elem)

def get_next(next_link=None):
_request = prepare_request(next_link)

_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = _failsafe_deserialize(
_models2.ErrorResponse,
response,
)
raise HttpResponseError(response=response, model=error)

return pipeline_response

return ItemPaged(get_next, extract_data)

@overload
def create_index(
self, index: _models1.SearchIndex, *, content_type: str = "application/json", **kwargs: Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from azure.core.tracing.decorator import distributed_trace

from .. import models as _models
from ..models._models import SearchIndexResponse as _SearchIndexResponse
from ._operations import (
_SearchIndexClientOperationsMixin as _SearchIndexClientOperationsMixinGenerated,
_SearchIndexerClientOperationsMixin as _SearchIndexerClientOperationsMixinGenerated,
Expand All @@ -24,6 +25,37 @@
import azure.search.documents


def _convert_index_response(response: _SearchIndexResponse) -> _models.SearchIndex:
"""Convert a SearchIndexResponse to a SearchIndex.

:param response: The SearchIndexResponse to convert.
:type response: ~azure.search.documents.indexes.models._models.SearchIndexResponse
:return: The converted SearchIndex.
:rtype: ~azure.search.documents.indexes.models.SearchIndex
"""
return _models.SearchIndex(
name=response.name,
fields=response.fields or [],
description=response.description,
scoring_profiles=response.scoring_profiles,
default_scoring_profile=response.default_scoring_profile,
cors_options=response.cors_options,
suggesters=response.suggesters,
analyzers=response.analyzers,
tokenizers=response.tokenizers,
token_filters=response.token_filters,
char_filters=response.char_filters,
normalizers=response.normalizers,
encryption_key=response.encryption_key,
similarity=response.similarity,
semantic_search=response.semantic,
vector_search=response.vector_search,
permission_filter_option=response.permission_filter_option,
purview_enabled=response.purview_enabled,
e_tag=response.e_tag,
)


class _SearchIndexClientOperationsMixin(_SearchIndexClientOperationsMixinGenerated):
"""Custom operations mixin for SearchIndexClient."""

Expand Down Expand Up @@ -325,6 +357,29 @@ def delete_knowledge_source(
**kwargs,
)

@distributed_trace
def list_indexes(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> ItemPaged[_models.SearchIndex]:
"""Lists all indexes available for a search service.

:keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated
list of JSON property names, or '*' for all properties. The default is all properties.
Default value is None.
:paramtype select: list[str]
:return: An iterator like instance of SearchIndex
:rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndex]
:raises ~azure.core.exceptions.HttpResponseError:
"""
if select is not None:
return cast(
ItemPaged[_models.SearchIndex],
self._list_indexes_with_selected_properties(
select=select,
cls=lambda objs: [_convert_index_response(x) for x in objs],
**kwargs,
),
)
return self._list_indexes(**kwargs)

@distributed_trace
def list_index_names(self, **kwargs: Any) -> ItemPaged[str]:
"""Lists the names of all indexes available for a search service.
Expand All @@ -333,7 +388,7 @@ def list_index_names(self, **kwargs: Any) -> ItemPaged[str]:
:rtype: ~azure.core.paging.ItemPaged[str]
:raises ~azure.core.exceptions.HttpResponseError:
"""
names = self.list_indexes(cls=lambda objs: [x.name for x in objs], **kwargs)
names = self._list_indexes(cls=lambda objs: [x.name for x in objs], **kwargs)
return cast(ItemPaged[str], names)

@distributed_trace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin):
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials_async.AsyncTokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2025-11-01-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Known values are
"2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down Expand Up @@ -115,9 +115,9 @@ class SearchIndexerClient(_SearchIndexerClientOperationsMixin):
credential type or a token credential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials_async.AsyncTokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2025-11-01-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Known values are
"2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Loading
Loading