[comment]: # aside: 1

[comment]: # ({f1f8a413-e205e572})
# 相关性 object

以下 objects 与 `correlation` API 直接相关。

[comment]: # ({/f1f8a413-e205e572})

[comment]: # ({f8f9bf74-935ba6ef})
### 关联

correlation 对象具有以下属性。

|Property|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|correlationid|ID|correlation 的 ID。<br><br>[属性行为](/manual/api/reference_commentary#property-behavior):<br>- *只读*<br>- 在更新操作中为 *必需*|
|name|string|correlation 的名称。<br><br>[属性行为](/manual/api/reference_commentary#property-behavior):<br>- 在创建操作中为 *必需*|
|description|string|correlation 的描述。|
|status|integer|correlation 是启用还是禁用。<br><br>可能的值：<br>0 - *(默认)* 启用；<br>1 - 禁用。|

[comment]: # ({/f8f9bf74-935ba6ef})

[comment]: # ({bdea5057-d12c2169})
### 关联操作

关联操作对象定义了在执行关联时将执行的操作。它具有以下属性。

|Property|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|type|integer|操作类型。<br><br>可能的值：<br>0 - 关闭旧事件；<br>1 - 关闭新事件。<br><br>[属性行为](/manual/api/reference_commentary#property-behavior):<br>- *required*|

[comment]: # ({/bdea5057-d12c2169})

[comment]: # ({b1607be6-d0662dba})
### 关联过滤器

关联过滤器对象定义了一组必须满足的条件，以执行已配置的关联操作。
它具有以下属性。

|Property|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|conditions|array|用于筛选结果的[过滤条件](#correlation-filter-condition)集合。这些条件将按照它们在公式中的排列顺序进行排序。<br><br>[Property behavior](/manual/api/reference_commentary#property-behavior):<br>- *required*|
|evaltype|integer|过滤条件的[求值方法](/manual/config/event_correlation/global#configuration)。<br><br>Possible values:<br>0 - And/Or;<br>1 - And;<br>2 - Or;<br>3 - Custom expression.<br><br>[Property behavior](/manual/api/reference_commentary#property-behavior):<br>- *required*|
|eval\_formula|string|用于计算过滤条件的生成表达式。该表达式包含引用特定过滤条件的 ID，这些 ID 通过其 `formulaid` 标识。对于使用自定义表达式的过滤器，`eval_formula` 的值等于 `formula` 的值。<br><br>[Property behavior](/manual/api/reference_commentary#property-behavior):<br>- *read-only*|
|formula|string|用户定义的表达式，用于计算使用自定义表达式的过滤器条件。该表达式必须包含引用特定过滤条件的 ID，这些 ID 通过其 `formulaid` 标识。表达式中使用的 ID 必须与过滤条件中定义的 ID 完全一致：不能有任何条件未使用或被省略。<br><br>[Property behavior](/manual/api/reference_commentary#property-behavior):<br>- *required* if `evaltype` is set to "custom expression"|

[comment]: # ({/b1607be6-d0662dba})

[comment]: # ({46c1514b-72ee5420})
#### 关联过滤条件

关联过滤条件对象定义了一个特定条件，在执行关联操作之前必须对其进行检查。

|Property|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|type|integer|条件类型。<br><br>可能的值：<br>0 - 旧事件标签；<br>1 - 新事件标签；<br>2 - 新事件主机组；<br>3 - 事件标签对；<br>4 - 旧事件标签值；<br>5 - 新事件标签值。<br><br>[Property behavior](/manual/api/reference_commentary#property-behavior)：<br>- *required*|
|tag|string|事件标签（旧或新）。<br><br>[Property behavior](/manual/api/reference_commentary#property-behavior)：<br>- 如果 `type` 设置为 "old event tag"、"new event tag"、"old event tag value" 或 "new event tag value"，则为 *required*|
|groupid|ID|主机组的 ID。<br><br>[Property behavior](/manual/api/reference_commentary#property-behavior)：<br>- 如果 `type` 设置为 "new event host group"，则为 *required*|
|oldtag|string|旧事件标签。<br><br>[Property behavior](/manual/api/reference_commentary#property-behavior)：<br>- 如果 `type` 设置为 "event tag pair"，则为 *required*|
|newtag|string|旧事件标签。<br><br>[Property behavior](/manual/api/reference_commentary#property-behavior)：<br>- 如果 `type` 设置为 "event tag pair"，则为 *required*|
|value|string|事件标签（旧或新）值。<br><br>[Property behavior](/manual/api/reference_commentary#property-behavior)：<br>- 如果 `type` 设置为 "old event tag value" 或 "new event tag value"，则为 *required*|
|formulaid|string|用于在自定义表达式中引用该条件的任意唯一 ID。只能包含大写字母。修改过滤条件时必须由用户定义，但在之后再次请求时会重新生成。|
|operator|integer|条件运算符。<br><br>[Property behavior](/manual/api/reference_commentary#property-behavior)：<br>- 如果 `type` 设置为 "new event host group"、"old event tag value" 或 "new event tag value"，则为 *required*|

::: notetip
要更好地理解如何将过滤器与各种
类型的表达式一起使用，请参见
[correlation.get](get#retrieve-correlations) 和
[correlation.create](create#using-a-custom-expression-filter) 方法
页面中的示例。
:::

以下运算符和值适用于每种条件
类型。

|Condition|Condition name|Supported operators|Expected value|
|---------|--------------|-------------------|--------------|
|2|主机组|=, <>|主机组 ID。|
|4|旧事件标签值|=, <>, like, not like|string|
|5|新事件标签值|=, <>, like, not like|string|

[comment]: # ({/46c1514b-72ee5420})
