def set_label(self, searchindex_id, event_id, event_type, sketch_id, user_id, label, toggle=False, remove=False, single_update=True):
    'Set label on event in the datastore.\n\n        Args:\n            searchindex_id: String of ElasticSearch index id\n            event_id: String of ElasticSearch event id\n            event_type: String of ElasticSearch document type\n            sketch_id: Integer of sketch primary key\n            user_id: Integer of user primary key\n            label: String with the name of the label\n            remove: Optional boolean value if the label should be removed\n            toggle: Optional boolean value if the label should be toggled\n            single_update: Boolean if the label should be indexed immediately.\n\n        Returns:\n            Dict with updated document body, or None if this is a single update.\n        '
    update_body = {'script': {'lang': 'painless', 'source': UPDATE_LABEL_SCRIPT, 'params': {'timesketch_label': {'name': str(label), 'user_id': user_id, 'sketch_id': sketch_id}, remove: remove}}}
    if toggle:
        update_body['script']['source'] = TOGGLE_LABEL_SCRIPT
    if (not single_update):
        script = update_body['script']
        return dict(source=script['source'], lang=script['lang'], params=script['params'])
    doc = self.client.get(index=searchindex_id, id=event_id, doc_type='_all')
    try:
        doc['_source']['timesketch_label']
    except KeyError:
        doc = {'doc': {'timesketch_label': []}}
        self.client.update(index=searchindex_id, doc_type=event_type, id=event_id, body=doc)
    self.client.update(index=searchindex_id, id=event_id, doc_type=event_type, body=update_body)
    return None
Set label on event in the datastore.

Args:
    searchindex_id: String of ElasticSearch index id
    event_id: String of ElasticSearch event id
    event_type: String of ElasticSearch document type
    sketch_id: Integer of sketch primary key
    user_id: Integer of user primary key
    label: String with the name of the label
    remove: Optional boolean value if the label should be removed
    toggle: Optional boolean value if the label should be toggled
    single_update: Boolean if the label should be indexed immediately.

Returns:
    Dict with updated document body, or None if this is a single update.
def set_label(self, searchindex_id, event_id, event_type, sketch_id, user_id, label, toggle=False, remove=False, single_update=True):
    'Set label on event in the datastore.\n\n        Args:\n            searchindex_id: String of ElasticSearch index id\n            event_id: String of ElasticSearch event id\n            event_type: String of ElasticSearch document type\n            sketch_id: Integer of sketch primary key\n            user_id: Integer of user primary key\n            label: String with the name of the label\n            remove: Optional boolean value if the label should be removed\n            toggle: Optional boolean value if the label should be toggled\n            single_update: Boolean if the label should be indexed immediately.\n\n        Returns:\n            Dict with updated document body, or None if this is a single update.\n        '
    update_body = {'script': {'lang': 'painless', 'source': UPDATE_LABEL_SCRIPT, 'params': {'timesketch_label': {'name': str(label), 'user_id': user_id, 'sketch_id': sketch_id}, remove: remove}}}
    if toggle:
        update_body['script']['source'] = TOGGLE_LABEL_SCRIPT
    if (not single_update):
        script = update_body['script']
        return dict(source=script['source'], lang=script['lang'], params=script['params'])
    doc = self.client.get(index=searchindex_id, id=event_id, doc_type='_all')
    try:
        doc['_source']['timesketch_label']
    except KeyError:
        doc = {'doc': {'timesketch_label': []}}
        self.client.update(index=searchindex_id, doc_type=event_type, id=event_id, body=doc)
    self.client.update(index=searchindex_id, id=event_id, doc_type=event_type, body=update_body)
    return None