def import_event(self, index_name, event_type, event=None, event_id=None, flush_interval=DEFAULT_FLUSH_INTERVAL, timeline_id=None):
    'Add event to Elasticsearch.\n\n        Args:\n            index_name: Name of the index in Elasticsearch\n            event_type: Type of event (e.g. plaso_event)\n            event: Event dictionary\n            event_id: Event Elasticsearch ID\n            flush_interval: Number of events to queue up before indexing\n            timeline_id: Optional ID number of a Timeline object this event\n                belongs to. If supplied an additional field will be added to\n                the store indicating the timeline this belongs to.\n        '
    if event:
        for (k, v) in event.items():
            if (not isinstance(k, six.text_type)):
                k = codecs.decode(k, 'utf8')
            if isinstance(v, six.binary_type):
                v = codecs.decode(v, 'utf8')
            event[k] = v
        header = {'index': {'_index': index_name}}
        update_header = {'update': {'_index': index_name, '_id': event_id}}
        if self.version.startswith('6'):
            header['index']['_type'] = event_type
            update_header['update']['_type'] = event_type
        if event_id:
            if event.get('lang'):
                event = {'script': event}
            else:
                event = {'doc': event}
            header = update_header
        if timeline_id:
            event['__ts_timeline_id'] = timeline_id
        self.import_events.append(header)
        self.import_events.append(event)
        self.import_counter['events'] += 1
        if ((self.import_counter['events'] % int(flush_interval)) == 0):
            _ = self.flush_queued_events()
            self.import_events = []
    elif self.import_events:
        _ = self.flush_queued_events()
    return self.import_counter['events']
Add event to Elasticsearch.

Args:
    index_name: Name of the index in Elasticsearch
    event_type: Type of event (e.g. plaso_event)
    event: Event dictionary
    event_id: Event Elasticsearch ID
    flush_interval: Number of events to queue up before indexing
    timeline_id: Optional ID number of a Timeline object this event
        belongs to. If supplied an additional field will be added to
        the store indicating the timeline this belongs to.
def import_event(self, index_name, event_type, event=None, event_id=None, flush_interval=DEFAULT_FLUSH_INTERVAL, timeline_id=None):
    'Add event to Elasticsearch.\n\n        Args:\n            index_name: Name of the index in Elasticsearch\n            event_type: Type of event (e.g. plaso_event)\n            event: Event dictionary\n            event_id: Event Elasticsearch ID\n            flush_interval: Number of events to queue up before indexing\n            timeline_id: Optional ID number of a Timeline object this event\n                belongs to. If supplied an additional field will be added to\n                the store indicating the timeline this belongs to.\n        '
    if event:
        for (k, v) in event.items():
            if (not isinstance(k, six.text_type)):
                k = codecs.decode(k, 'utf8')
            if isinstance(v, six.binary_type):
                v = codecs.decode(v, 'utf8')
            event[k] = v
        header = {'index': {'_index': index_name}}
        update_header = {'update': {'_index': index_name, '_id': event_id}}
        if self.version.startswith('6'):
            header['index']['_type'] = event_type
            update_header['update']['_type'] = event_type
        if event_id:
            if event.get('lang'):
                event = {'script': event}
            else:
                event = {'doc': event}
            header = update_header
        if timeline_id:
            event['__ts_timeline_id'] = timeline_id
        self.import_events.append(header)
        self.import_events.append(event)
        self.import_counter['events'] += 1
        if ((self.import_counter['events'] % int(flush_interval)) == 0):
            _ = self.flush_queued_events()
            self.import_events = []
    elif self.import_events:
        _ = self.flush_queued_events()
    return self.import_counter['events']