IBM Streams Elasticsearch integration
Project description
Overview
Provides functions to store tuple data as JSON documents in Elasticsearch indices.
This package exposes the com.ibm.streamsx.elasticsearch toolkit as Python methods for use with Streaming Analytics service on IBM Cloud and IBM Streams including IBM Cloud Pak for Data.
Sample
A simple hello world example of a Streams application writing string messages to an index:
from streamsx.topology.topology import * from streamsx.topology.schema import CommonSchema from streamsx.topology.context import submit import streamsx.elasticsearch as es topo = Topology('ElasticsearchHelloWorld') s = topo.source(['Hello', 'World!']).as_string() es.bulk_insert(s, 'test-index-cloud') submit('STREAMING_ANALYTICS_SERVICE', topo)
A simple example of a Streams application writing JSON messages to an index, with dynamic index name (part of the stream):
from streamsx.topology.topology import * from streamsx.topology.schema import CommonSchema, StreamSchema from streamsx.topology.context import submit import streamsx.elasticsearch as es schema = StreamSchema('tuple<rstring indexName, rstring document>') topo = Topology() s = topo.source([('idx1','{"msg":"This is message number 1"}'), ('idx2','{"msg":"This is message number 2"}')]) s = s.map(lambda x : x, schema=schema) es.bulk_insert_dynamic(s, index_name_attribute='indexName', message_attribute='document') submit('STREAMING_ANALYTICS_SERVICE', topo)
Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for streamsx.elasticsearch-1.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebd1cc56988e70735b9709365fd5f5580cc3ecb489a5ff69d3540d53070b5ba5 |
|
MD5 | 6828fc3c134b9cac9da09bf98e23096c |
|
BLAKE2b-256 | 26e0d6bf037f40aafcf944756ea0791cbff31bd9cf1e17aab4d7b9aa956e7bfc |
Close
Hashes for streamsx.elasticsearch-1.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38a0f96a5cb40cdd067d912cbea1469d972fea6fb270926d78e6d677126889b2 |
|
MD5 | 7cb33fdf228ec78eebcfa942d9272c88 |
|
BLAKE2b-256 | 0990ee28aaff18ed6424f8807cd36f383f150b3eb500b0f211d0f746befec876 |