你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Saved Searches - Create Or Update

为给定工作区创建或更新保存的搜索。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchId}?api-version=2023-09-01

URI 参数

名称 必需 类型 说明
resourceGroupName
path True

string

minLength: 1
maxLength: 90

资源组的名称。 名称不区分大小写。

savedSearchId
path True

string

保存的搜索的 ID。

subscriptionId
path True

string

minLength: 1

目标订阅的 ID。

workspaceName
path True

string

minLength: 4
maxLength: 63
pattern: ^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$

工作区的名称。

api-version
query True

string

minLength: 1

用于此作的 API 版本。

请求正文

名称 必需 类型 说明
properties.category True

string

已保存搜索的类别。 这有助于用户更快地查找已保存的搜索。

properties.displayName True

string

保存的搜索显示名称。

properties.query True

string

保存的搜索的查询表达式。

etag

string

已保存搜索的 ETag。 若要替代现有的已保存搜索,请使用“*”或指定当前的 Etag

properties.functionAlias

string

如果查询用作函数,则函数别名。

properties.functionParameters

string

如果查询用作函数,则为可选函数参数。 值应采用以下格式:“param-name1:type1 = default_value1,param-name2:type2 = default_value2”。 有关更多示例和正确的语法,请参阅 https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions

properties.tags

Tag[]

附加到已保存搜索的标记。

properties.version

integer (int64)

查询语言的版本号。 当前版本为 2,为默认值。

响应

名称 类型 说明
200 OK

SavedSearch

确定响应定义。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

SavedSearchCreateOrUpdate

示例请求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-00000000000/resourcegroups/TestRG/providers/Microsoft.OperationalInsights/workspaces/TestWS/savedSearches/00000000-0000-0000-0000-00000000000?api-version=2023-09-01

{
  "properties": {
    "category": "Saved Search Test Category",
    "displayName": "Create or Update Saved Search Test",
    "version": 2,
    "functionAlias": "heartbeat_func",
    "functionParameters": "a:int=1",
    "query": "Heartbeat | summarize Count() by Computer | take a",
    "tags": [
      {
        "name": "Group",
        "value": "Computer"
      }
    ]
  }
}

示例响应

{
  "id": "subscriptions/00000000-0000-0000-0000-000000000005/resourceGroups/mms-eus/providers/Microsoft.OperationalInsights/workspaces/AtlantisDemo/savedSearches/test-new-saved-search-id-2015",
  "etag": "W/\"datetime'2017-10-02T23%3A15%3A41.0709875Z'\"",
  "properties": {
    "category": "Saved Search Test Category",
    "displayName": "Create or Update Saved Search Test",
    "functionAlias": "heartbeat_func",
    "functionParameters": "a:int=1",
    "query": "Heartbeat | summarize Count() by Computer | take a",
    "version": 2
  }
}

定义

名称 说明
SavedSearch

保存的搜索结果的值对象。

Tag

已保存搜索的标记。

SavedSearch

保存的搜索结果的值对象。

名称 类型 说明
etag

string

已保存搜索的 ETag。 若要替代现有的已保存搜索,请使用“*”或指定当前的 Etag

id

string

资源的完全限定资源 ID。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

资源的名称

properties.category

string

已保存搜索的类别。 这有助于用户更快地查找已保存的搜索。

properties.displayName

string

保存的搜索显示名称。

properties.functionAlias

string

如果查询用作函数,则函数别名。

properties.functionParameters

string

如果查询用作函数,则为可选函数参数。 值应采用以下格式:“param-name1:type1 = default_value1,param-name2:type2 = default_value2”。 有关更多示例和正确的语法,请参阅 https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions

properties.query

string

保存的搜索的查询表达式。

properties.tags

Tag[]

附加到已保存搜索的标记。

properties.version

integer (int64)

查询语言的版本号。 当前版本为 2,为默认值。

type

string

资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

Tag

已保存搜索的标记。

名称 类型 说明
name

string

标记名称。

value

string

标记值。