(self, event, datastore, sketch=None, analyzer=None)
Initialize Event object.

        Args:
            event: Dictionary of event from OpenSearch.
            datastore: Instance of OpenSearchDataStore.
            sketch: Optional instance of a Sketch object.
            analyzer: Optional instance of a BaseAnalyzer object.

        Raises:
            KeyError if event dictionary is missing mandatory fields.
Initialize Event object.
Initialize Event object .
def __init__(self, event, datastore, sketch=None, analyzer=None):
        """Initialize Event object.

        Args:
            event: Dictionary of event from OpenSearch.
            datastore: Instance of OpenSearchDataStore.
            sketch: Optional instance of a Sketch object.
            analyzer: Optional instance of a BaseAnalyzer object.

        Raises:
            KeyError if event dictionary is missing mandatory fields.
        """
        self._analyzer = analyzer
        self.datastore = datastore
        self.sketch = sketch

        self.updated_event = {}

        try:
            self.event_id = event['_id']
            self.event_type = event['_type']
            self.index_name = event['_index']
            self.timeline_id = event.get('_source', {}).get('__ts_timeline_id')
            self.source = event.get('_source', None)
        except KeyError as e:
            raise KeyError('Malformed event: {0!s}'.format(e)) from e
def __init__ ( self , event , datastore , sketch = None , analyzer = None ) : self . _analyzer = analyzer self . datastore = datastore self . sketch = sketch self . updated_event = { } try : self . event_id = event [ '_id' ] self . event_type = event [ '_type' ] self . index_name = event [ '_index' ] self . timeline_id = event . get ( '_source' , { } ) . get ( '__ts_timeline_id' ) self . source = event . get ( '_source' , None ) except KeyError as e : raise KeyError ( 'Malformed event: {0!s}' . format ( e ) ) from e