AWS 文档 SDK 示例
将 UpdateIndexingConfiguration 与 AWS SDK 或 CLI 配合使用
以下代码示例演示如何使用 UpdateIndexingConfiguration。
- C++
-
- SDK for C++
-
注意
查看 GitHub,了解更多信息。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 //! Update the indexing configuration. /*! \param thingIndexingConfiguration: A ThingIndexingConfiguration object which is ignored if not set. \param thingGroupIndexingConfiguration: A ThingGroupIndexingConfiguration object which is ignored if not set. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::IoT::updateIndexingConfiguration( const Aws::IoT::Model::ThingIndexingConfiguration &thingIndexingConfiguration, const Aws::IoT::Model::ThingGroupIndexingConfiguration &thingGroupIndexingConfiguration, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::IoT::IoTClient iotClient(clientConfiguration); Aws::IoT::Model::UpdateIndexingConfigurationRequest request; if (thingIndexingConfiguration.ThingIndexingModeHasBeenSet()) { request.SetThingIndexingConfiguration(thingIndexingConfiguration); } if (thingGroupIndexingConfiguration.ThingGroupIndexingModeHasBeenSet()) { request.SetThingGroupIndexingConfiguration(thingGroupIndexingConfiguration); } Aws::IoT::Model::UpdateIndexingConfigurationOutcome outcome = iotClient.UpdateIndexingConfiguration( request); if (outcome.IsSuccess()) { std::cout << "UpdateIndexingConfiguration succeeded." << std::endl; } else { std::cerr << "UpdateIndexingConfiguration failed." << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }-
有关 API 详细信息,请参阅《适用于 C++ 的 AWS SDK API Reference》中的 UpdateIndexingConfiguration。
-
- CLI
-
- AWS CLI
-
启用事物索引
以下
update-indexing-configuration示例启用事物索引,以支持使用 AWS_Things 索引来搜索注册表数据、阴影数据和事物连接状态。aws iot update-indexing-configuration --thing-indexing-configurationthingIndexingMode=REGISTRY_AND_SHADOW,thingConnectivityIndexingMode=STATUS此命令不生成任何输出。
有关更多信息,请参阅《AWS IoT 开发人员指南》中的管理事物索引。
-
有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 UpdateIndexingConfiguration
。
-
SearchIndex
UpdateThing