OpenSearchMemory / Paginator / SearchEvents
SearchEvents¶
- class OpenSearchMemory.Paginator.SearchEvents¶
paginator = client.get_paginator('search_events')
- paginate(**kwargs)¶
Creates an iterator that will paginate through responses from
OpenSearchMemory.Client.search_events().See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate( spaceId='string', actorId='string', sessionIds=[ 'string', ], query={...}|[...]|123|123.4|'string'|True|None, sort={...}|[...]|123|123.4|'string'|True|None, PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } )
- Parameters:
spaceId (string) –
[REQUIRED]
The space whose events to search. Use
actorIdandsessionIdsto narrow the search within it.actorId (string) –
[REQUIRED]
The actor whose events to search (exact match). Required: every search covers exactly one actor, and an event stored without an actor is never returned. Narrow the search further with
sessionIds, combined by AND. This is the only way to filter by actor: a query that referencessystem_metadata.actor_idfails withValidationException(reasonnonFilterableField).sessionIds (list) –
Returns only events from one of these sessions (exact match). Combined with
actorIdby AND. Omit for no session filter. An empty list fails validation. An event stored without a session never matches a session filter. This is the only way to filter by session: a query that referencessystem_metadata.session_idfails withValidationException(reasonnonFilterableField).(string) –
The ID of a session, which groups an actor’s events.
query (document) –
[REQUIRED]
The query: a subset of the OpenSearch Query DSL (see
SearchQuery), validated by the same rules as onSearchMemories. Query event text astextand embeddings asvector. A search covers both conversation turns and chunks of documents submitted as ablob. You can’t use actor and session fields here. Use the top-levelactorIdandsessionIds.To search only the content of particular events, filter on
event_idswithtermorterms, for example with thesourceEventIdsthat aSearchMemoriesresult returns. Atermsclause onevent_idscan list up to 10 event IDs. More IDs fail withValidationException(reasonqueryBodyTooLarge). You can useevent_idsonly interm,terms, andexistsqueries.sort (document) – The sort order (see
SearchSort). Omit to return the most relevant events first.PaginationConfig (dict) –
A dictionary that provides parameters to control pagination.
MaxItems (integer) –
The total number of items to return. If the total number of items available is more than the value specified in max-items then a
NextTokenwill be provided in the output that you can use to resume pagination.PageSize (integer) –
The size of each page.
StartingToken (string) –
A token to specify where to start paginating. This is the
NextTokenfrom a previous response.
- Return type:
dict
- Returns:
Response Syntax
{ 'events': [ { 'eventId': 'string', 'score': 123.0, 'systemMetadata': { 'actorId': 'string', 'sessionId': 'string', 'createdAt': datetime(2015, 1, 1), 'updatedAt': datetime(2015, 1, 1) }, 'metadata': { 'string': 'string' }, 'matchedContent': 'string' }, ], 'NextToken': 'string' }
Response Structure
(dict) –
events (list) –
The matching event chunks, in the order
sortrequests, or most relevant first when it has none. Empty when nothing matches. Each result is the matching chunk of an event. CallGetEventfor the whole event.(dict) –
A
SearchEventsresult: the matching chunk of an event and its provenance. UnlikeEventSummaryfromListEvents, it has a relevance score and the matched content, but not the full payload.eventId (string) –
The ID of the event that the chunk belongs to. Use it with
GetEventorDeleteEvent.score (float) –
The relevance score of the result. A higher score is more relevant. Scores aren’t normalized to a fixed range and can be greater than 1, so use them only to order results.
systemMetadata (dict) –
Provenance for the chunk: the owning actor and session, and when it was created and last updated. It is the same block that
ListMemoriesandSearchMemoriesreturn. Event chunks are never modified, soupdatedAtalways equalscreatedAt.Absent when the service has no provenance for the chunk.
actorId (string) –
The owning actor. Absent when none was recorded.
sessionId (string) –
The owning session. Absent when none was recorded.
createdAt (datetime) –
When the record was created. Always present on
ListMemoriesandGetMemory. It can be absent from search results.updatedAt (datetime) –
When the record was last updated. Equals
createdAtfor a record that has never been updated, and always for aSearchEventsresult.
metadata (dict) –
The event’s metadata tags. All values are strings. In a query, filter on a tag as
metadata.<key>.(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.
matchedContent (string) –
The text of the matching chunk.
NextToken (string) –
A token to resume pagination.