Notatka
Dostęp do tej strony wymaga autoryzacji. Może spróbować zalogować się lub zmienić katalogi.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Dataverse search delivers fast and comprehensive search results across multiple tables, in a single list, sorted by relevance. It also provides capabilities to support suggestions and autocompletion experiences in apps.
Note
This documentation for developers describes how to programmatically interact with the Dataverse Search APIs.
For information about the user experience and how to configure Dataverse Search for your environment, see the following topics:
How to use
Developers can use the search APIs in three different ways:
- The Dataverse SDK for .NET
- The Web API
/api/data/v9.xendpoint - The native search
/api/search/v2.0/endpoint
Search operations are defined as Dataverse messages using Custom APIs. For .NET projects, use the SDK for .NET.
Currently, the SDK doesn't include classes to use these operations. For .NET Framework projects, use the Power Platform CLI pac modelbuilder build to generate *Request and *Response classes for these messages, just as you would for any custom action.
You can also use the OrganizationRequest and OrganizationResponse classes.
For more information, see:
Search operations
Search provides three operations to support a user interface that enables searching for data.
| SDK Message Name Web API Action Search 2.0 Endpoint |
Description |
|---|---|
searchquerysearchquery Action /api/search/v2.0/query |
Returns a search results page. See Dataverse Search query |
searchsuggestsearchsuggest Action /api/search/v2.0/suggest |
Provides suggestions as the user enters text into a form field. See Dataverse Search suggest |
searchautocompletesearchautocomplete Action /api/search/v2.0/autocomplete |
Provides autocompletion of input as the user enters text into a form field. See Dataverse Search autocomplete |
Two operations help you understand whether search is enabled and how it's configured.
| SDK Message Name Web API Function Search 2.0 Endpoint |
Description |
|---|---|
searchstatisticssearchstatistics Function /api/search/v2.0/statistics |
Provides organization storage size and document count. See Dataverse Search statistics |
searchstatussearchstatus Function /api/search/v2.0/status |
Search status of an Organization. See Dataverse Search Status |
Use Insomnia with Dataverse search
If you use Insomnia with Dataverse Web API, you know how useful it is to try using the APIs. For instructions about setting up an Insomnia environment to authenticate with the Dataverse Web API, see Use Insomnia with Dataverse Web API.
You can use the same instructions with the search operations that use Web API functions and actions. If you want to use the native search 2.0 endpoint, change these two environment variables:
| Variable | Web API Value | Search 2.0 Endpoint value |
|---|---|---|
version |
9.2 |
2.0 |
webapiurl |
{{url}}/api/data/v{{version}}/ |
{{url}}/api/search/v{{version}}/ |
Detect if search is enabled
Dataverse search is enabled by default for production environments, but it's an opt-out feature so you can turn it off even in a production environment. If you're using an environment other than a production environment, an administrator must enable it. Learn how to enable search in the admin center.
Error when search isn't enabled
If you use the query, suggest, or autocomplete operations when the environment isn't enabled, you get these errors:
ErrorCode:
-2147185397Message:Dataverse Search feature is disabled for this organization.
You can detect whether the search service is enabled by checking the settings in the organization table or by using the Dataverse Search Status operation.
Check Organization table
The Organization table contains a single row of data that controls how the organization is configured. The IsExternalSearchIndexEnabled boolean column indicates whether search is enabled for the organization.
This function returns the IsExternalSearchIndexEnabled property value for the organization.
static bool IsExternalSearchIndexEnabled(IOrganizationService service) {
QueryExpression query = new QueryExpression("organization") {
ColumnSet = new ColumnSet("isexternalsearchindexenabled")
};
EntityCollection organizations = service.RetrieveMultiple(query);
return (bool)organizations.Entities.FirstOrDefault()["isexternalsearchindexenabled"];
}
More information: Build queries with QueryExpression
Enable tables and columns for search
Data in Dataverse controls which tables and columns are enabled for search.
Enable tables
You can enable only those tables for Dataverse search where the EntityMetadata.CanEnableSyncToExternalSearchIndex.Value property and EntityMetadata.ChangeTrackingEnabled property are true. If the CanEnableSyncToExternalSearchIndex.CanBeChanged value is false, you can't change the value. For more information, see Managed properties.
To enable a table for Dataverse Search, set the EntityMetadata.SyncToExternalSearchIndex property to true.
Check the values for a table by using the SDK or Web API with the table logical name. Replace account in the following queries with the logical name of the table you want to check.
static void RetrieveSearchSettingsForTable(IOrganizationService service, string logicalName = "account") {
RetrieveMetadataChangesRequest request = new RetrieveMetadataChangesRequest() {
Query = new EntityQueryExpression() {
Properties = new MetadataPropertiesExpression(
"CanEnableSyncToExternalSearchIndex",
"SyncToExternalSearchIndex")
}
};
request.Query.Criteria.Conditions.Add(
new MetadataConditionExpression(
propertyName: "LogicalName",
conditionOperator: MetadataConditionOperator.Equals,
value: logicalName));
var response = (RetrieveMetadataChangesResponse)service.Execute(request);
EntityMetadata table = response.EntityMetadata.FirstOrDefault();
Console.WriteLine($"CanEnableSyncToExternalSearchIndex: {table.CanEnableSyncToExternalSearchIndex.Value}");
Console.WriteLine($"SyncToExternalSearchIndex: {table.SyncToExternalSearchIndex}");
}
Output
CanEnableSyncToExternalSearchIndex: True
SyncToExternalSearchIndex: True
For more information, see:
For more information, see:
Enable columns
The columns that are searchable for the table depend on whether they're included in the Quick Find view for each table. You can query the definition of the view in the View (SavedQuery) table and update it programmatically.
For more information, see:
Service protection limits
Dataverse search enforces lower limits, so you don't reach the common Dataverse Service protection API limits. You manage these limits in the same way.
Dataverse search allows a user to send one request per second, and each organization is limited to 150 requests per minute. If you exceed this limit, the API returns a 429 Too Many Requests error. If the API returns a 429 error, wait until the period defined in the Retry-After response header value before sending more requests. The value represents the number of seconds to wait.
See also
Dataverse Search query
Dataverse Search suggest
Dataverse Search autocomplete
Dataverse Search statistics and status
Dataverse legacy search
Configure Dataverse search for your environment