Use UpdateIndexingConfiguration with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use UpdateIndexingConfiguration with an AWS SDK or CLI

The following code examples show how to use UpdateIndexingConfiguration.

C++
SDK for C++
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

//! 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(); }
CLI
AWS CLI

To enable thing indexing

The following update-indexing-configuration example enables thing indexing to support searching registry data, shadow data, and thing connectivity status using the AWS_Things index.

aws iot update-indexing-configuration --thing-indexing-configuration thingIndexingMode=REGISTRY_AND_SHADOW,thingConnectivityIndexingMode=STATUS

This command produces no output.

For more information, see Managing Thing Indexing in the AWS IoT Developers Guide.