diff --git a/sdk/search/azure-search-documents/CHANGELOG.md b/sdk/search/azure-search-documents/CHANGELOG.md index b2b387e291f7..220b27aae6c8 100644 --- a/sdk/search/azure-search-documents/CHANGELOG.md +++ b/sdk/search/azure-search-documents/CHANGELOG.md @@ -4,9 +4,10 @@ ### Features Added -### Breaking Changes - -### Bugs Fixed +- Added properties to `SearchClient.search`: `session_id`, `scoring_statistics`. +- Added properties to `SearchIndexerDataSourceConnection`: `identity`, `encryption_key`. +- Added `select` property to the following `SearchIndexClient` operations: `get_synonym_maps`, `list_indexes`. +- Added `select` property to the following `SearchIndexersClient` operations: `get_data_source_connections`, `get_indexers`, `get_skillsets`. ### Other Changes diff --git a/sdk/search/azure-search-documents/azure/search/documents/_search_client.py b/sdk/search/azure-search-documents/azure/search/documents/_search_client.py index 79fce398aad8..d7801844bb31 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_search_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_search_client.py @@ -226,6 +226,18 @@ def search(self, search_text, **kwargs): # pylint:disable=too-many-locals $skip to implement client-side paging of search results. If results are truncated due to server-side paging, the response will include a continuation token that can be used to issue another Search request for the next page of results. + :keyword scoring_statistics: A value that specifies whether we want to calculate scoring + statistics (such as document frequency) globally for more consistent scoring, or locally, for + lower latency. The default is 'local'. Use 'global' to aggregate scoring statistics globally + before scoring. Using global scoring statistics can increase latency of search queries. + Possible values include: "local", "global". + :paramtype scoring_statistics: str or ~azure.search.documents.models.ScoringStatistics + :keyword str session_id: A value to be used to create a sticky session, which can help getting more + consistent results. As long as the same sessionId is used, a best-effort attempt will be made + to target the same replica set. Be wary that reusing the same sessionID values repeatedly can + interfere with the load balancing of the requests across replicas and adversely affect the + performance of the search service. The value used as sessionId cannot start with a '_' + character. :rtype: SearchItemPaged[dict] .. admonition:: Example: @@ -274,6 +286,8 @@ def search(self, search_text, **kwargs): # pylint:disable=too-many-locals select = kwargs.pop("select", None) skip = kwargs.pop("skip", None) top = kwargs.pop("top", None) + session_id = kwargs.pop("session_id", None) + scoring_statistics = kwargs.pop("scoring_statistics", None) query_answer = kwargs.pop("query_answer", None) query_answer_count = kwargs.pop("query_answer_count", None) @@ -312,6 +326,8 @@ def search(self, search_text, **kwargs): # pylint:disable=too-many-locals select=select if isinstance(select, six.string_types) else None, skip=skip, top=top, + session_id=session_id, + scoring_statistics=scoring_statistics ) if isinstance(select, list): query.select(select) diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py index 65a51b4610da..fafa78592533 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_search_client_async.py @@ -205,6 +205,19 @@ async def search(self, search_text, **kwargs): # pylint:disable=too-many-locals $skip to implement client-side paging of search results. If results are truncated due to server-side paging, the response will include a continuation token that can be used to issue another Search request for the next page of results. + :keyword scoring_statistics: A value that specifies whether we want to calculate scoring + statistics (such as document frequency) globally for more consistent scoring, or locally, for + lower latency. The default is 'local'. Use 'global' to aggregate scoring statistics globally + before scoring. Using global scoring statistics can increase latency of search queries. + Possible values include: "local", "global". + :paramtype scoring_statistics: str or ~azure.search.documents.models.ScoringStatistics + :keyword session_id: A value to be used to create a sticky session, which can help getting more + consistent results. As long as the same sessionId is used, a best-effort attempt will be made + to target the same replica set. Be wary that reusing the same sessionID values repeatedly can + interfere with the load balancing of the requests across replicas and adversely affect the + performance of the search service. The value used as sessionId cannot start with a '_' + character. + :paramtype session_id: str :rtype: AsyncSearchItemPaged[dict] .. admonition:: Example: @@ -253,6 +266,8 @@ async def search(self, search_text, **kwargs): # pylint:disable=too-many-locals select = kwargs.pop("select", None) skip = kwargs.pop("skip", None) top = kwargs.pop("top", None) + session_id = kwargs.pop("session_id", None) + scoring_statistics = kwargs.pop("scoring_statistics", None) query_answer = kwargs.pop("query_answer", None) query_answer_count = kwargs.pop("query_answer_count", None) @@ -291,6 +306,8 @@ async def search(self, search_text, **kwargs): # pylint:disable=too-many-locals select=select if isinstance(select, six.string_types) else None, skip=skip, top=top, + session_id=session_id, + scoring_statistics=scoring_statistics ) if isinstance(select, list): query.select(select) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_index_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_index_client.py index fa5906f32b53..e01be47a27e2 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_index_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_index_client.py @@ -97,12 +97,18 @@ def list_indexes(self, **kwargs): # type: (**Any) -> ItemPaged[SearchIndex] """List the indexes in an Azure Search service. + :keyword select: Selects which top-level properties of the skillsets to retrieve. Specified as a + list of JSON property names, or '*' for all properties. The default is all + properties. + :paramtype select: list[str] :return: List of indexes :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndex] :raises: ~azure.core.exceptions.HttpResponseError """ kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + if kwargs.get('select', None): + kwargs['select'] = ','.join(kwargs['select']) # pylint:disable=protected-access return self._client.indexes.list( cls=lambda objs: [SearchIndex._from_generated(x) for x in objs], **kwargs @@ -306,6 +312,10 @@ def get_synonym_maps(self, **kwargs): # type: (**Any) -> List[SynonymMap] """List the Synonym Maps in an Azure Search service. + :keyword select: Selects which top-level properties of the skillsets to retrieve. Specified as a + list of JSON property names, or '*' for all properties. The default is all + properties. + :paramtype select: list[str] :return: List of synonym maps :rtype: list[~azure.search.documents.indexes.models.SynonymMap] :raises: ~azure.core.exceptions.HttpResponseError @@ -321,6 +331,8 @@ def get_synonym_maps(self, **kwargs): """ kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + if kwargs.get('select', None): + kwargs['select'] = ','.join(kwargs['select']) result = self._client.synonym_maps.list(**kwargs) # pylint:disable=protected-access return [SynonymMap._from_generated(x) for x in result.synonym_maps] diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_indexer_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_indexer_client.py index c7e55716c554..03c351a68f3a 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_indexer_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_search_indexer_client.py @@ -161,6 +161,10 @@ def get_indexers(self, **kwargs): # type: (**Any) -> Sequence[SearchIndexer] """Lists all indexers available for a search service. + :keyword select: Selects which top-level properties of the skillsets to retrieve. Specified as a + list of JSON property names, or '*' for all properties. The default is all + properties. + :paramtype select: list[str] :return: List of all the SearchIndexers. :rtype: `list[~azure.search.documents.indexes.models.SearchIndexer]` @@ -174,6 +178,8 @@ def get_indexers(self, **kwargs): :caption: List all the SearchIndexers """ kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + if kwargs.get('select', None): + kwargs['select'] = ','.join(kwargs['select']) result = self._client.indexers.list(**kwargs) return result.indexers @@ -390,6 +396,10 @@ def get_data_source_connections(self, **kwargs): # type: (**Any) -> Sequence[SearchIndexerDataSourceConnection] """Lists all data source connections available for a search service. + :keyword select: Selects which top-level properties of the skillsets to retrieve. Specified as a + list of JSON property names, or '*' for all properties. The default is all + properties. + :paramtype select: list[str] :return: List of all the data source connections. :rtype: `list[~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection]` @@ -403,6 +413,8 @@ def get_data_source_connections(self, **kwargs): :caption: List all the SearchIndexerDataSourceConnections """ kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + if kwargs.get('select', None): + kwargs['select'] = ','.join(kwargs['select']) result = self._client.data_sources.list(**kwargs) # pylint:disable=protected-access return [ @@ -465,6 +477,10 @@ def get_skillsets(self, **kwargs): # type: (**Any) -> List[SearchIndexerSkillset] """List the SearchIndexerSkillsets in an Azure Search service. + :keyword select: Selects which top-level properties of the skillsets to retrieve. Specified as a + list of JSON property names, or '*' for all properties. The default is all + properties. + :paramtype select: list[str] :return: List of SearchIndexerSkillsets :rtype: list[~azure.search.documents.indexes.models.SearchIndexerSkillset] :raises: ~azure.core.exceptions.HttpResponseError @@ -480,6 +496,8 @@ def get_skillsets(self, **kwargs): """ kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + if kwargs.get('select', None): + kwargs['select'] = ','.join(kwargs['select']) result = self._client.skillsets.list(**kwargs) return [SearchIndexerSkillset._from_generated(skillset) for skillset in result.skillsets] # pylint:disable=protected-access diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_index_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_index_client.py index d20618583fd2..27e51a82357b 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_index_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_index_client.py @@ -103,13 +103,18 @@ def list_indexes(self, **kwargs): # type: (**Any) -> AsyncItemPaged[SearchIndex] """List the indexes in an Azure Search service. + :keyword select: Selects which top-level properties of the skillsets to retrieve. Specified as a + list of JSON property names, or '*' for all properties. The default is all + properties. + :paramtype select: list[str] :return: List of indexes :rtype: ~azure.core.async_paging.AsyncItemPaged[:class:`~azure.search.documents.indexes.models.SearchIndex`] :raises: ~azure.core.exceptions.HttpResponseError """ kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) - + if kwargs.get('select', None): + kwargs['select'] = ','.join(kwargs['select']) # pylint:disable=protected-access return self._client.indexes.list( cls=lambda objs: [SearchIndex._from_generated(x) for x in objs], **kwargs @@ -313,6 +318,10 @@ async def get_synonym_maps(self, **kwargs): # type: (**Any) -> List[SynonymMap] """List the Synonym Maps in an Azure Search service. + :keyword select: Selects which top-level properties of the skillsets to retrieve. Specified as a + list of JSON property names, or '*' for all properties. The default is all + properties. + :paramtype select: list[str] :return: List of synonym maps :rtype: list[~azure.search.documents.indexes.models.SynonymMap] :raises: ~azure.core.exceptions.HttpResponseError @@ -328,6 +337,8 @@ async def get_synonym_maps(self, **kwargs): """ kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + if kwargs.get('select', None): + kwargs['select'] = ','.join(kwargs['select']) result = await self._client.synonym_maps.list(**kwargs) # pylint:disable=protected-access return [SynonymMap._from_generated(x) for x in result.synonym_maps] diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_indexer_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_indexer_client.py index d0e589f9a39e..92f986603834 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_indexer_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_search_indexer_client.py @@ -162,6 +162,10 @@ async def get_indexers(self, **kwargs): # type: (**Any) -> Sequence[SearchIndexer] """Lists all indexers available for a search service. + :keyword select: Selects which top-level properties of the skillsets to retrieve. Specified as a + list of JSON property names, or '*' for all properties. The default is all + properties. + :paramtype select: list[str] :return: List of all the SearchIndexers. :rtype: `list[~azure.search.documents.indexes.models.SearchIndexer]` @@ -175,6 +179,8 @@ async def get_indexers(self, **kwargs): :caption: List all the SearchIndexers """ kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + if kwargs.get('select', None): + kwargs['select'] = ','.join(kwargs['select']) result = await self._client.indexers.list(**kwargs) return result.indexers @@ -393,6 +399,10 @@ async def get_data_source_connection(self, name, **kwargs): # type: (str, **Any) -> SearchIndexerDataSourceConnection """Retrieves a data source connection definition. + :keyword select: Selects which top-level properties of the skillsets to retrieve. Specified as a + list of JSON property names, or '*' for all properties. The default is all + properties. + :paramtype select: list[str] :param name: The name of the data source connection to retrieve. :type name: str :return: The SearchIndexerDataSourceConnection that is fetched. @@ -406,6 +416,8 @@ async def get_data_source_connection(self, name, **kwargs): :caption: Retrieve a SearchIndexerDataSourceConnection """ kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + if kwargs.get('select', None): + kwargs['select'] = ','.join(kwargs['select']) result = await self._client.data_sources.get(name, **kwargs) # pylint:disable=protected-access return SearchIndexerDataSourceConnection._from_generated(result) @@ -453,6 +465,10 @@ async def get_skillsets(self, **kwargs): # type: (**Any) -> List[SearchIndexerSkillset] """List the SearchIndexerSkillsets in an Azure Search service. + :keyword select: Selects which top-level properties of the skillsets to retrieve. Specified as a + list of JSON property names, or '*' for all properties. The default is all + properties. + :paramtype select: list[str] :return: List of SearchIndexerSkillsets :rtype: list[~azure.search.documents.indexes.models.SearchIndexerSkillset] :raises: ~azure.core.exceptions.HttpResponseError @@ -468,6 +484,8 @@ async def get_skillsets(self, **kwargs): """ kwargs["headers"] = self._merge_client_headers(kwargs.get("headers")) + if kwargs.get('select', None): + kwargs['select'] = ','.join(kwargs['select']) result = await self._client.skillsets.list(**kwargs) return [SearchIndexerSkillset._from_generated(skillset) for skillset in result.skillsets] # pylint:disable=protected-access diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py index 9a88f0e0b1b7..5800abac4e3c 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py @@ -849,6 +849,21 @@ class SearchIndexerDataSourceConnection(msrest.serialization.Model): ~azure.search.documents.models.DataDeletionDetectionPolicy :keyword e_tag: The ETag of the data source. :paramtype e_tag: str + :keyword identity: An explicit managed identity to use for this datasource. If not specified and + the connection string is a managed identity, the system-assigned managed identity is used. If + not specified, the value remains unchanged. If "none" is specified, the value of this property + is cleared. + :paramtype identity: ~azure.search.documents.indexes.models.SearchIndexerDataIdentity + :keyword encryption_key: A description of an encryption key that you create in Azure Key Vault. + This key is used to provide an additional level of encryption-at-rest for your datasource + definition when you want full assurance that no one, not even Microsoft, can decrypt your data + source definition in Azure Cognitive Search. Once you have encrypted your data source + definition, it will always remain encrypted. Azure Cognitive Search will ignore attempts to set + this property to null. You can change this property as needed if you want to rotate your + encryption key; Your datasource definition will be unaffected. Encryption with customer-managed + keys is not available for free search services, and is only available for paid services created + on or after January 1, 2019. + :paramtype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey """ _validation = { @@ -872,7 +887,9 @@ class SearchIndexerDataSourceConnection(msrest.serialization.Model): "key": "dataDeletionDetectionPolicy", "type": "DataDeletionDetectionPolicy", }, + 'encryption_key': {'key': 'encryptionKey', 'type': 'SearchResourceEncryptionKey'}, "e_tag": {"key": "@odata\\.etag", "type": "str"}, + 'identity': {'key': 'identity', 'type': 'SearchIndexerDataIdentity'}, } def __init__(self, **kwargs): @@ -889,6 +906,8 @@ def __init__(self, **kwargs): "data_deletion_detection_policy", None ) self.e_tag = kwargs.get("e_tag", None) + self.encryption_key = kwargs.get("encryption_key", None) + self.identity = kwargs.get("identity", None) def _to_generated(self): if self.connection_string is None or self.connection_string == "": @@ -905,6 +924,8 @@ def _to_generated(self): data_change_detection_policy=self.data_change_detection_policy, data_deletion_detection_policy=self.data_deletion_detection_policy, e_tag=self.e_tag, + encryption_key=self.encryption_key, + identity=self.identity ) @classmethod @@ -925,6 +946,8 @@ def _from_generated(cls, search_indexer_data_source): data_change_detection_policy=search_indexer_data_source.data_change_detection_policy, data_deletion_detection_policy=search_indexer_data_source.data_deletion_detection_policy, e_tag=search_indexer_data_source.e_tag, + encryption_key=search_indexer_data_source.encryption_key, + identity=search_indexer_data_source.identity ) diff --git a/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py index c93b4ac66b9c..23213d7bb771 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py @@ -35,7 +35,8 @@ QueryLanguage, QuerySpellerType, QueryType, - SearchMode, + ScoringStatistics, + SearchMode ) from .._search_client import odata @@ -52,5 +53,6 @@ "QueryLanguage", "QuerySpellerType", "QueryType", + "ScoringStatistics", "SearchMode", )