Type: New Feature
Affects Version/s: None
Fix Version/s: 0.10.0
Elasticsearch is likely to be a common output datastore for Samza so it would be good to have a Producer (and possibly Consumer) as part of the core project.
Elasticsearch organises data into indexes which can contain multiple types of documents. Each document has a id which it is identified by and the source which is it's actual data. These map well on to concepts in Samza.
Elasticsearch also has mappings which defines how it indexes the documents pushed to it. I don't think the Samza System should be concerned with this.
(index, type) -> stream
id -> key
source -> message
The main one needing to be agreed upon is how the index and type are defined as a stream. We've started by simply joining them with a / as they would in the elasticsearch REST api and using that as the stream name.
The java elasticsearch client can deal with the source being a variety of types that can be presented as json (Object, Map, byte). We could just pass objects to the Producer or use the Samza json serde to handle that (or maybe both), we're currently passing through the message object and assuming the client can deal with it.
Elasticsearch also has the ability to bulk index documents, so combining this with correctly flushing the Producer can get good performance.
Finally we'd need to think how this can be configured. Elasticsearch java client has two different transports that have various configuration. Currently we are only using the TransportClient, we should probably make it configurable or maybe not initially.