AWS IoT

2019/11/13 - AWS IoT - 2 new 3 updated api methods

Changes  This release adds the custom fields definition support in the index definition for AWS IoT Fleet Indexing Service. Custom fields can be used as an aggregation field to run aggregations with both existing GetStatistics API and newly added GetCardinality, GetPercentiles APIs. GetStatistics will return all statistics (min/max/sum/avg/count...) with this release. For more information, please refer to our latest documentation: https://docs.aws.amazon.com/iot/latest/developerguide/iot-indexing.html

GetCardinality (new) Link ¶

Returns the number of things with distinct values for the aggregation field.

See also: AWS API Documentation

Request Syntax

client.get_cardinality(
    indexName='string',
    queryString='string',
    aggregationField='string',
    queryVersion='string'
)
type indexName

string

param indexName

The name of the index to search.

type queryString

string

param queryString

[REQUIRED]

The search query.

type aggregationField

string

param aggregationField

The field to aggregate.

type queryVersion

string

param queryVersion

The query version.

rtype

dict

returns

Response Syntax

{
    'cardinality': 123
}

Response Structure

  • (dict) --

    • cardinality (integer) --

      The number of things that match the query.

GetPercentiles (new) Link ¶

Returns the percentile values for the aggregation field. The results from GetPercentiles is an approximation. The default percentile groupings are: 1,5,25,50,75,95,99. You can specify custom percentile grouping using the percents argument to the GetPercentiles API.

See also: AWS API Documentation

Request Syntax

client.get_percentiles(
    indexName='string',
    queryString='string',
    aggregationField='string',
    queryVersion='string',
    percents=[
        123.0,
    ]
)
type indexName

string

param indexName

The name of the index to search.

type queryString

string

param queryString

[REQUIRED]

The query string.

type aggregationField

string

param aggregationField

The field to aggregate.

type queryVersion

string

param queryVersion

The query version.

type percents

list

param percents

The percentile groups returned.

  • (float) --

rtype

dict

returns

Response Syntax

{
    'percentiles': [
        {
            'percent': 123.0,
            'value': 123.0
        },
    ]
}

Response Structure

  • (dict) --

    • percentiles (list) --

      The percentile values of the aggregated fields.

      • (dict) --

        Describes the percentile and percentile value.

        • percent (float) --

          The percentile.

        • value (float) --

          The value.

GetIndexingConfiguration (updated) Link ¶
Changes (response)
{'thingGroupIndexingConfiguration': {'customFields': [{'name': 'string',
                                                       'type': 'Number | '
                                                               'String | '
                                                               'Boolean'}],
                                     'managedFields': [{'name': 'string',
                                                        'type': 'Number | '
                                                                'String | '
                                                                'Boolean'}]},
 'thingIndexingConfiguration': {'customFields': [{'name': 'string',
                                                  'type': 'Number | String | '
                                                          'Boolean'}],
                                'managedFields': [{'name': 'string',
                                                   'type': 'Number | String | '
                                                           'Boolean'}]}}

Gets the search configuration.

See also: AWS API Documentation

Request Syntax

client.get_indexing_configuration()
rtype

dict

returns

Response Syntax

{
    'thingIndexingConfiguration': {
        'thingIndexingMode': 'OFF'|'REGISTRY'|'REGISTRY_AND_SHADOW',
        'thingConnectivityIndexingMode': 'OFF'|'STATUS',
        'managedFields': [
            {
                'name': 'string',
                'type': 'Number'|'String'|'Boolean'
            },
        ],
        'customFields': [
            {
                'name': 'string',
                'type': 'Number'|'String'|'Boolean'
            },
        ]
    },
    'thingGroupIndexingConfiguration': {
        'thingGroupIndexingMode': 'OFF'|'ON',
        'managedFields': [
            {
                'name': 'string',
                'type': 'Number'|'String'|'Boolean'
            },
        ],
        'customFields': [
            {
                'name': 'string',
                'type': 'Number'|'String'|'Boolean'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • thingIndexingConfiguration (dict) --

      Thing indexing configuration.

      • thingIndexingMode (string) --

        Thing indexing mode. Valid values are:

        • REGISTRY – Your thing index contains registry data only.

        • REGISTRY_AND_SHADOW - Your thing index contains registry and shadow data.

        • OFF - Thing indexing is disabled.

      • thingConnectivityIndexingMode (string) --

        Thing connectivity indexing mode. Valid values are:

        • STATUS – Your thing index contains connectivity status. To enable thing connectivity indexing, thingIndexMode must not be set to OFF.

        • OFF - Thing connectivity status indexing is disabled.

      • managedFields (list) --

        Contains fields that are indexed and whose types are already known by the Fleet Indexing service.

        • (dict) --

          Describes the name and data type at a field.

          • name (string) --

            The name of the field.

          • type (string) --

            The datatype of the field.

      • customFields (list) --

        Contains custom field names and their data type.

        • (dict) --

          Describes the name and data type at a field.

          • name (string) --

            The name of the field.

          • type (string) --

            The datatype of the field.

    • thingGroupIndexingConfiguration (dict) --

      The index configuration.

      • thingGroupIndexingMode (string) --

        Thing group indexing mode.

      • managedFields (list) --

        Contains fields that are indexed and whose types are already known by the Fleet Indexing service.

        • (dict) --

          Describes the name and data type at a field.

          • name (string) --

            The name of the field.

          • type (string) --

            The datatype of the field.

      • customFields (list) --

        Contains custom field names and their data type.

        • (dict) --

          Describes the name and data type at a field.

          • name (string) --

            The name of the field.

          • type (string) --

            The datatype of the field.

GetStatistics (updated) Link ¶
Changes (response)
{'statistics': {'average': 'double',
                'maximum': 'double',
                'minimum': 'double',
                'stdDeviation': 'double',
                'sum': 'double',
                'sumOfSquares': 'double',
                'variance': 'double'}}

Gets statistics returns the count, average, sum, minimum, maximum, sumOfSquares, variance, and standard deviation for the specified aggregated field. If the aggregation field is of type String, only the count statistic is returned.

See also: AWS API Documentation

Request Syntax

client.get_statistics(
    indexName='string',
    queryString='string',
    aggregationField='string',
    queryVersion='string'
)
type indexName

string

param indexName

The name of the index to search. The default value is AWS_Things .

type queryString

string

param queryString

[REQUIRED]

The query used to search. You can specify "*" for the query string to get the count of all indexed things in your AWS account.

type aggregationField

string

param aggregationField

The aggregation field name.

type queryVersion

string

param queryVersion

The version of the query used to search.

rtype

dict

returns

Response Syntax

{
    'statistics': {
        'count': 123,
        'average': 123.0,
        'sum': 123.0,
        'minimum': 123.0,
        'maximum': 123.0,
        'sumOfSquares': 123.0,
        'variance': 123.0,
        'stdDeviation': 123.0
    }
}

Response Structure

  • (dict) --

    • statistics (dict) --

      The statistics returned by the Fleet Indexing service based on the query and aggregation field.

      • count (integer) --

        The count of things that match the query.

      • average (float) --

        The average of the aggregated field values.

      • sum (float) --

        The sum of the aggregated field values.

      • minimum (float) --

        The minimum aggregated field value.

      • maximum (float) --

        The maximum aggregated field value.

      • sumOfSquares (float) --

        The sum of the squares of the aggregated field values.

      • variance (float) --

        The variance of the aggregated field values.

      • stdDeviation (float) --

        The standard deviation of the aggregated field valuesl

UpdateIndexingConfiguration (updated) Link ¶
Changes (request)
{'thingGroupIndexingConfiguration': {'customFields': [{'name': 'string',
                                                       'type': 'Number | '
                                                               'String | '
                                                               'Boolean'}],
                                     'managedFields': [{'name': 'string',
                                                        'type': 'Number | '
                                                                'String | '
                                                                'Boolean'}]},
 'thingIndexingConfiguration': {'customFields': [{'name': 'string',
                                                  'type': 'Number | String | '
                                                          'Boolean'}],
                                'managedFields': [{'name': 'string',
                                                   'type': 'Number | String | '
                                                           'Boolean'}]}}

Updates the search configuration.

See also: AWS API Documentation

Request Syntax

client.update_indexing_configuration(
    thingIndexingConfiguration={
        'thingIndexingMode': 'OFF'|'REGISTRY'|'REGISTRY_AND_SHADOW',
        'thingConnectivityIndexingMode': 'OFF'|'STATUS',
        'managedFields': [
            {
                'name': 'string',
                'type': 'Number'|'String'|'Boolean'
            },
        ],
        'customFields': [
            {
                'name': 'string',
                'type': 'Number'|'String'|'Boolean'
            },
        ]
    },
    thingGroupIndexingConfiguration={
        'thingGroupIndexingMode': 'OFF'|'ON',
        'managedFields': [
            {
                'name': 'string',
                'type': 'Number'|'String'|'Boolean'
            },
        ],
        'customFields': [
            {
                'name': 'string',
                'type': 'Number'|'String'|'Boolean'
            },
        ]
    }
)
type thingIndexingConfiguration

dict

param thingIndexingConfiguration

Thing indexing configuration.

  • thingIndexingMode (string) -- [REQUIRED]

    Thing indexing mode. Valid values are:

    • REGISTRY – Your thing index contains registry data only.

    • REGISTRY_AND_SHADOW - Your thing index contains registry and shadow data.

    • OFF - Thing indexing is disabled.

  • thingConnectivityIndexingMode (string) --

    Thing connectivity indexing mode. Valid values are:

    • STATUS – Your thing index contains connectivity status. To enable thing connectivity indexing, thingIndexMode must not be set to OFF.

    • OFF - Thing connectivity status indexing is disabled.

  • managedFields (list) --

    Contains fields that are indexed and whose types are already known by the Fleet Indexing service.

    • (dict) --

      Describes the name and data type at a field.

      • name (string) --

        The name of the field.

      • type (string) --

        The datatype of the field.

  • customFields (list) --

    Contains custom field names and their data type.

    • (dict) --

      Describes the name and data type at a field.

      • name (string) --

        The name of the field.

      • type (string) --

        The datatype of the field.

type thingGroupIndexingConfiguration

dict

param thingGroupIndexingConfiguration

Thing group indexing configuration.

  • thingGroupIndexingMode (string) -- [REQUIRED]

    Thing group indexing mode.

  • managedFields (list) --

    Contains fields that are indexed and whose types are already known by the Fleet Indexing service.

    • (dict) --

      Describes the name and data type at a field.

      • name (string) --

        The name of the field.

      • type (string) --

        The datatype of the field.

  • customFields (list) --

    Contains custom field names and their data type.

    • (dict) --

      Describes the name and data type at a field.

      • name (string) --

        The name of the field.

      • type (string) --

        The datatype of the field.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --