The panko.storage.impl_elasticsearch Module

class panko.storage.impl_elasticsearch.Connection(url, conf)

Bases: panko.storage.base.Connection

Put the event data into an ElasticSearch db.

Events in ElasticSearch are indexed by day and stored by event_type. An example document:

{"_index":"events_2014-10-21",
 "_type":"event_type0",
 "_id":"dc90e464-65ab-4a5d-bf66-ecb956b5d779",
 "_score":1.0,
 "_source":{"timestamp": "2014-10-21T20:02:09.274797"
            "traits": {"id4_0": "2014-10-21T20:02:09.274797",
                       "id3_0": 0.7510790937279408,
                       "id2_0": 5,
                       "id1_0": "18c97ba1-3b74-441a-b948-a702a30cbce2"}
           }
}
CAPABILITIES = {'events': {'query': {'simple': True}}}
STORAGE_CAPABILITIES = {'storage': {'production_ready': True}}
get_event_types()

Return all event types as an iterable of strings.

get_events(event_filter, pagination=None)

Return an iterable of model.Event objects.

get_trait_types(event_type)

Return a dictionary containing the name and data type of the trait.

Only trait types for the provided event_type are returned. :param event_type: the type of the Event

get_traits(event_type, trait_type=None)

Return all trait instances associated with an event_type.

If trait_type is specified, only return instances of that trait type. :param event_type: the type of the Event to filter by :param trait_type: the name of the Trait to filter by

record_events(events)

Write the events to the backend storage system.

Parameters

events – a list of model.Event objects.

upgrade()

Migrate the database to version or the most recent version.