:py:mod:`flow.record.adapter.elastic` ===================================== .. py:module:: flow.record.adapter.elastic Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: flow.record.adapter.elastic.ElasticWriter flow.record.adapter.elastic.ElasticReader Attributes ~~~~~~~~~~ .. autoapisummary:: flow.record.adapter.elastic.__usage__ flow.record.adapter.elastic.log .. py:data:: __usage__ :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ ElasticSearch adapter --- Write usage: rdump -w elastic+[PROTOCOL]://[IP]:[PORT]?index=[INDEX] Read usage: rdump elastic+[PROTOCOL]://[IP]:[PORT]?index=[INDEX] [IP]:[PORT]: ip and port to elastic host [PROTOCOL]: http or https. Defaults to https when "+[PROTOCOL]" is omitted Optional arguments: [INDEX]: name of the index to use (default: records) [VERIFY_CERTS]: verify certs of Elasticsearch instance (default: True) [HASH_RECORD]: make record unique by hashing record [slow] (default: False) """ .. raw:: html
.. py:data:: log .. py:class:: ElasticWriter(uri: str, index: str = 'records', verify_certs: Union[str, bool] = True, http_compress: Union[str, bool] = True, hash_record: Union[str, bool] = False, **kwargs) Bases: :py:obj:`flow.record.adapter.AbstractWriter` .. py:method:: record_to_document(record: flow.record.base.Record, index: str) -> dict Convert a record to a Elasticsearch compatible document dictionary .. py:method:: document_stream() -> Iterator[dict] Generator of record documents on the Queue .. py:method:: streaming_bulk_thread() -> None Thread that streams the documents to ES via the bulk api .. py:method:: write(record: flow.record.base.Record) -> None Write a record. .. py:method:: flush() -> None Flush any buffered writes. .. py:method:: close() -> None Close the Writer, no more writes will be possible. .. py:class:: ElasticReader(uri: str, index: str = 'records', verify_certs: Union[str, bool] = True, http_compress: Union[str, bool] = True, selector: Union[None, flow.record.selector.Selector, flow.record.selector.CompiledSelector] = None, **kwargs) Bases: :py:obj:`flow.record.adapter.AbstractReader` .. py:method:: __iter__() -> Iterator[flow.record.base.Record] Return a record iterator. .. py:method:: close() -> None Close the Reader, can be overriden to properly free resources.