Metadata-Version: 2.4
Name: chibi_elasticsearch
Version: 1.3.0
Summary: Package with templates and snippets for elasticsearch
Home-page: https://github.com/dem4ply/chibi_elasticsearch
Author: dem4ply
Author-email: dem4ply@gmail.com
License: WTFPL
Keywords: chibi_elasticsearch
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: Public Domain
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
License-File: LICENSE
License-File: AUTHORS.rst
Requires-Dist: chibi>=0.17.0
Requires-Dist: elasticsearch-dsl<8,>7
Provides-Extra: vcr
Requires-Dist: vcrpy-unittest>=0.1.7; extra == "vcr"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: summary

===================
chibi_elasticsearch
===================


.. image:: https://img.shields.io/pypi/v/chibi_elasticsearch.svg
        :target: https://pypi.python.org/pypi/chibi_elasticsearch

.. image:: https://readthedocs.org/projects/chibi-elasticsearch/badge/?version=latest
        :target: https://chibi-elasticsearch.readthedocs.io/en/latest/?badge=latest
        :alt: 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.


* Free software: WTFPL
* Documentation: https://chibi-elasticsearch.readthedocs.io.


*********
basic use
*********

models
======

.. code-block:: python

	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
=============

.. code-block:: python

	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

	.. code-block:: python

		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.
