Skip to main content

Pip.Services Logo
ElasticSearch components for Python

This module is a part of the Pip.Services polyglot microservices toolkit.

The Elasticsearch module contains logging components with data storage on the Elasticsearch server.

The module contains the following packages:

  • Build - contains a factory for the construction of components
  • Log - Logging components

Quick links:

Use

Install the Python package as

pip install pip-services3-elasticsearch

Microservice components shall perform logging usual way using CompositeLogger component. The CompositeLogger will get ElasticSearchLogger from references and will redirect log messages there among other destinations.

from pip_services3_commons.config import IConfigurable
from pip_services3_commons.refer import IReferenceable
from pip_services3_components.log import CompositeLogger


class MyComponent(IConfigurable, IReferenceable):
    def __init__(self):
        super(MyComponent, self).__init__()
        self.__logger = CompositeLogger()

    def configure(self, config):
        self.__logger.configure(config)

    def set_references(self, references):
        self.__logger.set_references(references)

    def my_method(self, correlation_id, param1):
        self.__logger.trace(correlation_id, 'Executed method mycomponent.mymethod')
        # ...

Configuration for your microservice that includes ElasticSearch logger may look the following way.

...
{{#if ELASTICSEARCH_ENABLED}}
- descriptor: pip-services:logger:elasticsearch:default:1.0
  connection:
    uri: {{{ELASTICSEARCG_SERVICE_URI}}}
    host: {{{ELASTICSEARCH_SERVICE_HOST}}}{{#unless ELASTICSEARCH_SERVICE_HOST}}localhost{{/unless}}
    port: {{ELASTICSEARCG_SERVICE_PORT}}{{#unless ELASTICSEARCH_SERVICE_PORT}}9200{{/unless}}\ 
{{/if}}
...

Develop

For development you shall install the following prerequisites:

  • Python 3.7+
  • Visual Studio Code or another IDE of your choice
  • Docker

Install dependencies:

pip install -r requirements.txt

Run automated tests:

python test.py

Generate API documentation:

./docgen.ps1

Before committing changes run dockerized build and test as:

./build.ps1
./test.ps1
./clear.ps1

Configure the vm.max_map_count

sudo sysctl -w vm.max_map_count=262144

fixes:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Typed vs Type-less indexes

ES version 7 stopped supporting "types" and encouraged a separation of disperate data into different indexes. By default, this version of pip-services3-elasticsearch-node will support 7.x type-less indexes. You can support to the 6.x "typed" approach by setting the include_type_name option to true. This allows it to work with either 6.x or 7.x ElasticSearch servers.

You can read more about how this is accomplished here

Contacts

The library is created and maintained by Sergey Seroukhov.

The documentation is written by:

  • Mark Makarychev

Release files for pip-services3-elasticsearch 3.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pip-services3-elasticsearch 3.1.6
File Size Uploaded
pip_services3_elasticsearch-3.1.6.tar.gz 11.6 kB Details

Release files / pip_services3_elasticsearch-3.1.6.tar.gz

Download URL pip_services3_elasticsearch-3.1.6.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7ae997902866c04f01cc956d67d5dd5bc5cfdcf269752f6d052f332341dc4692
BLAKE2b-256 checksum
How to use checksums
0b3a48500aa80741438e979b1527f1ce9cd662353ef8cba505aa0778ef903ce2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

Release history Release notifications | RSS feed

This release

3.1.6 This release

1 release file

3.1.5

1 release file

3.1.4

1 release file

3.1.3

1 release file

3.1.2

1 release file

3.1.1

1 release file

3.1.0

1 release file

3.0.4

1 release file

3.0.3

1 release file

3.0.2

1 release file

3.0.1

1 release file

3.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page