Skip to main content

Package with templates and snippets for elasticsearch

Project description

chibi_elasticsearch

https://img.shields.io/pypi/v/chibi_elasticsearch.svg Documentation Status

chibi_elasticsearch is a lightweight Python package that provides templates and reusable snippets for working with Elasticsearch. It is intended to simplify common tasks such as creating models class.

The package is designed to work with elasticsearch_dsl.

basic use

models

from chibi_elasticsearch.models import Chibi_model
from chibi_elasticsearch.analyzers import name_space, name
from chibi_elasticsearch.snippet import create_index_if_not_exists
from elasticsearch_dsl import field


class Person( Chibi_model ):
        name = field.Text(
                analyzer=name, multi=True,
                fields={
                        'space': field.Text( analyzer=name_space, multi=True ),
                        'keyword': field.Keyword( multi=True ),
                }
        )

create_index_if_not_exists( Person )

some_one = Person( name="john smith" )
some_one.save()
print( "name:", some_one.name )
print( "create_at:", some_one.create_at )
print( "update_at:", some_one.update_at )

review config

from chibi_elasticsearch.config import load_elasticsearch_config, review_elasticsearch_config
from chibi.config import configuration

configuration.elasticsearch.connections.default.hosts = 'localhost'
configuration.elasticsearch.connections.default.port = 80
configuration.loggers[ 'elasticsearch' ].level = "WARNING"

# Load connections (e.g., from chibi config)
load_elasticsearch_config()

# Check configuration
if not review_elasticsearch_config():
        raise RuntimeError("Elasticsearch not configured correctly")

History

1.3.0 (2026-03-20)

  • add shorcut for mock save from documents

  • add property for pk

1.2.0 (2026-03-04)

  • add shortcut class to do unittest with vcr that ignore all configured hosts

  • add function to get all hosts configured

1.1.0 (2026-03-03)

  • add logic for build test index using chibi config

    from chibi.config import configuration
    configuration.elasticsearch.test_app = True
    assert build_index_name( 'hello' ) == 'test__hello'

1.0.0 (2026-03-03)

  • definition for base model and analyzers

  • configuration handling for connections

  • analyzers ready for text processing

  • basic model with automatic created_at and updated_at fields

0.0.1 (2026-03-03)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chibi_elasticsearch-1.3.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chibi_elasticsearch-1.3.0-py2.py3-none-any.whl (7.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file chibi_elasticsearch-1.3.0.tar.gz.

File metadata

  • Download URL: chibi_elasticsearch-1.3.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for chibi_elasticsearch-1.3.0.tar.gz
Algorithm Hash digest
SHA256 109e9498c5f277bdc4f137996e633afa4c69215e132badfdeb3c35e223b75aa5
MD5 ccd4e2135d3f94ede5afd8b6eff21481
BLAKE2b-256 2116b3d78276addd54ff3f869f1d0c368c50198636d22585d750dc1d9dba8dd7

See more details on using hashes here.

File details

Details for the file chibi_elasticsearch-1.3.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for chibi_elasticsearch-1.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5038b7d312d3915cfb4fe855f5b9da1bde3bee61c06efc87f2d6b65a28bb07a7
MD5 e3248588c9ae8ac29dae89849dc5d8a5
BLAKE2b-256 b1ed25fdb1a466110a0f219d767abb794fd1a67804284c88a0439186daaa5867

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page