OpenSearchMemory / Client / list_events

list_events

OpenSearchMemory.Client.list_events(**kwargs)

Lists the events in a session, sorted by time. Optionally limit the results to events whose eventTimestamp falls between eventTimestampAfter and eventTimestampBefore. Returns event metadata only. Call GetEvent for the payload. For full-text or relevance search, use SearchEvents.

If the space uses a customer managed AWS KMS key, the call can also fail because of the key. It fails with AccessDeniedException if you aren’t allowed to use the key, and with ThrottlingException if AWS KMS throttles the request. It fails with ValidationException if the key is disabled, pending deletion, or deleted.

See also: AWS API Documentation

Request Syntax

response = client.list_events(
    spaceId='string',
    actorId='string',
    sessionId='string',
    eventTimestampBefore=datetime(2015, 1, 1),
    eventTimestampAfter=datetime(2015, 1, 1),
    sortOrder='ASC'|'DESC',
    metadataFilters={
        'string': 'string'
    },
    maxResults=123,
    nextToken='string'
)
Parameters:
  • spaceId (string) –

    [REQUIRED]

    The ID of the space.

  • actorId (string) –

    [REQUIRED]

    The actor whose events to list.

  • sessionId (string) –

    [REQUIRED]

    The session whose events to list. To find events across sessions, use SearchEvents.

  • eventTimestampBefore (datetime) – Inclusive upper bound on eventTimestamp: only events at or before this time are returned. Omit for no upper bound.

  • eventTimestampAfter (datetime) –

    Inclusive lower bound on eventTimestamp: only events at or after this time are returned. Omit for no lower bound.

    If it’s later than eventTimestampBefore, the request fails with ValidationException.

  • sortOrder (string) – The order of the results by eventTimestamp: ASC or DESC. The default is DESC, most recent first.

  • metadataFilters (dict) –

    Returns only events whose metadata contains every one of these key-value pairs. Omit, or leave empty, for no metadata filter. The service applies the filter after it reads events, so a page can hold fewer than maxResults events, or none, and still return a nextToken. Keep paging until nextToken is absent.

    • (string) –

      A metadata key: letters, digits, hyphens ( -), and underscores ( _). Dots are not allowed, because a query uses dots to separate nested field names.

      • (string) –

        The value of a metadata entry.

  • maxResults (integer) – The maximum number of events to return, from 1 to 100. The default is 20.

  • nextToken (string) – The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Return type:

dict

Returns:

Response Syntax

{
    'events': [
        {
            'eventId': 'string',
            'metadata': {
                'string': 'string'
            },
            'eventTimestamp': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • events (list) –

      The events, without their payloads. Call GetEvent for an event’s payload.

      • (dict) –

        A summary of an event, as returned by ListEvents. It doesn’t include the payload.

        • eventId (string) –

          The event’s ID.

        • metadata (dict) –

          The event’s metadata tags, as supplied to CreateEvent. May be empty.

          • (string) –

            A metadata key: letters, digits, hyphens ( -), and underscores ( _). Dots are not allowed, because a query uses dots to separate nested field names.

            • (string) –

              The value of a metadata entry.

        • eventTimestamp (datetime) –

          The time the event occurred.

    • nextToken (string) –

      The token for the next set of results. Absent when there are no more results.

Exceptions

  • OpenSearchMemory.Client.exceptions.ResourceNotFoundException

  • OpenSearchMemory.Client.exceptions.AccessDeniedException

  • OpenSearchMemory.Client.exceptions.ThrottlingException

  • OpenSearchMemory.Client.exceptions.InternalServerException

  • OpenSearchMemory.Client.exceptions.ValidationException