Experimental
@aws-cdk/aws-iot-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
OpenSearchAction Class
The action to write data to an Amazon OpenSearch Service domain.
| Stability | Experimental |
|---|---|
| Source | lib/open-search-action.ts |
Example
ts
import * as opensearch from 'aws-cdk-lib/aws-opensearchservice';
declare const domain: opensearch.Domain;
const topicRule = new iot.TopicRule(this, 'TopicRule', {
sql: iot.IotSql.fromStringAsVer20160323(
"SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'",
),
});
topicRule.addAction(new actions.OpenSearchAction(domain, {
id: 'my-id',
index: 'my-index',
type: 'my-type',
}));
python
import aws_cdk.aws_opensearchservice as opensearch
# domain: opensearch.Domain
topic_rule = iot.TopicRule(self, "TopicRule",
sql=iot.IotSql.from_string_as_ver20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'")
)
topic_rule.add_action(actions.OpenSearchAction(domain,
id="my-id",
index="my-index",
type="my-type"
))
java
import software.amazon.awscdk.services.opensearchservice.*;
Domain domain;
TopicRule topicRule = TopicRule.Builder.create(this, "TopicRule")
.sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'"))
.build();
topicRule.addAction(OpenSearchAction.Builder.create(domain)
.id("my-id")
.index("my-index")
.type("my-type")
.build());
csharp
// Install: dotnet add package Amazon.CDK.AWS.IoT.Actions.Alpha
using Amazon.CDK.AWS.OpenSearchService;
Domain domain;
var topicRule = new TopicRule(this, "TopicRule", new TopicRuleProps {
Sql = IotSql.FromStringAsVer20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'")
});
topicRule.AddAction(new OpenSearchAction(domain, new OpenSearchActionProps {
Id = "my-id",
Index = "my-index",
Type = "my-type"
}));
go
// Install: go get github.com/aws/aws-cdk-go/awscdkiotactionsalpha/v2
import opensearch "github.com/aws/aws-cdk-go/awscdk"
var domain Domain
topicRule := iot.NewTopicRule(this, jsii.String("TopicRule"), &TopicRuleProps{
Sql: iot.IotSql_FromStringAsVer20160323(jsii.String("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'")),
})
topicRule.AddAction(actions.NewOpenSearchAction(domain, &OpenSearchActionProps{
Id: jsii.String("my-id"),
Index: jsii.String("my-index"),
Type: jsii.String("my-type"),
}))
Initializer
ts
new OpenSearchAction(domain: Domain, props: OpenSearchActionProps)
python
OpenSearchAction(domain: Domain, props: OpenSearchActionProps)
java
new OpenSearchAction(Domain domain, OpenSearchActionProps props)
csharp
new OpenSearchAction(Domain domain, OpenSearchActionProps props)
go
NewOpenSearchAction(Domain Domain, Props OpenSearchActionProps)