Metadata-Version: 2.1
Name: collective.elasticsearch
Version: 5.0.0a1
Summary: elasticsearch integration with plone
Home-page: https://github.com/collective/collective.elasticsearch
Author: Nathan Van Gheem
Author-email: vangheem@gmail.com
License: GPL version 2
Project-URL: PyPI, https://pypi.python.org/pypi/collective.elasticsearch
Project-URL: Source, https://github.com/collective/collective.elasticsearch
Project-URL: Tracker, https://github.com/collective/collective.elasticsearch/issues
Keywords: plone elasticsearch search indexing
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Plone :: 5.2
Classifier: Framework :: Plone :: 6.0
Classifier: Framework :: Plone :: Addon
Classifier: Framework :: Plone
Classifier: Framework :: Zope :: 4
Classifier: Framework :: Zope :: 5
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: test
License-File: LICENSE.GPL


<h1 align="center">collective.elasticsearch</h1>

<div align="center">

[![PyPI](https://img.shields.io/pypi/v/collective.elasticsearch)](https://pypi.org/project/collective.elasticsearch/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/collective.elasticsearch)](https://pypi.org/project/collective.elasticsearch/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/collective.elasticsearch)](https://pypi.org/project/collective.elasticsearch/)
[![PyPI - License](https://img.shields.io/pypi/l/collective.elasticsearch)](https://pypi.org/project/collective.elasticsearch/)
[![PyPI - Status](https://img.shields.io/pypi/status/collective.elasticsearch)](https://pypi.org/project/collective.elasticsearch/)


[![PyPI - Plone Versions](https://img.shields.io/pypi/frameworkversions/plone/collective.elasticsearch)](https://pypi.org/project/collective.elasticsearch/)

[![Code analysis checks](https://github.com/collective/collective.elasticsearch/actions/workflows/code-analysis.yml/badge.svg)](https://github.com/collective/collective.elasticsearch/actions/workflows/code-analysis.yml)
[![Tests](https://github.com/collective/collective.elasticsearch/actions/workflows/tests.yml/badge.svg)](https://github.com/collective/collective.elasticsearch/actions/workflows/tests.yml)
![Code Style](https://img.shields.io/badge/Code%20Style-Black-000000)

[![GitHub contributors](https://img.shields.io/github/contributors/collective/collective.elasticsearch)](https://github.com/collective/collective.elasticsearch)
[![GitHub Repo stars](https://img.shields.io/github/stars/collective/collective.elasticsearch?style=social)](https://github.com/collective/collective.elasticsearch)

</div>

## Introduction

This package aims to index all fields the portal_catalog indexes and allows you to delete the `Title`, `Description` and `SearchableText` indexes which can provide significant improvement to performance and RAM usage.

Then, ElasticSearch queries are ONLY used when Title, Description and SearchableText text are in the query. Otherwise, the plone's default catalog will be used. This is because Plone's default catalog is faster on normal queries than using ElasticSearch.


## Install Elastic Search

For a comprehensive documentation about the different options of installing Elastic Search, please read [their documentation](https://www.elastic.co/guide/en/elasticsearch/reference/7.7/install-elasticsearch.html).

A quick start, using Docker would be:

```shell
docker run \
		-e "discovery.type=single-node" \
		-e "cluster.name=docker-cluster" \
		-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
		-p 9200:9200 \
		elasticsearch:7.7.0
```

### Test the installation

Run, on your shell:

```shell
curl http://localhost:9200/
```
And you should see the Hudsucker Proxy reference? "You Know, for Search"

## Install collective.elasticsearch

First, add `collective.elasticsearch` to your package dependencies, or install it with `pip` (the same one used by your Plone installation):

```shell
pip install collective.elasticsearch
```

Restart Plone, and go to the `Control Panel`, click in `Add-ons`, and select `Elastic Search`.

Now, go to `Add-on Configuration` and:

- Check "Enable"
- Click "Convert Catalog"
- Click "Rebuild Catalog"

You now have a insanely scalable modern search engine. Now live the life of the Mind!


## Compatibility

- Python 3
- Plone 5.2 and above
- Tested with Elastic Search 7.7.0

## State

Support for all index column types is done EXCEPT for the DateRecurringIndex index column type. If you are doing a full text search along with a query that contains a DateRecurringIndex column, it will not work.


## Celery support

This package comes with Celery support where all indexing operations will be pushed into celery to be run asynchronously.

Please see instructions for `collective.celery` to see how this works.

## Developing this package

Create the virtual enviroment and install all dependencies:

```shell
make build
```

Start Plone in foreground:

```shell
make start
```


### Running tests

```shell
make tests
```


### Formatting the codebase

```shell
make format
```

### Linting the codebase

```shell
make lint
```

## License

The project is licensed under the GPLv2.


# Changelog

## 5.0.0a1 (2022-09-14)

- Refactor hook.index_batch to reduce the number of calls do Elastic Search @ericof

- Implement plone/code-analysis-action @ericof

- Add support to Plone 6.0 @ericof

- Drop support to Plone versions 4.3, 5.0 and 5.1 @ericof, @andreclimaco

- Drop support to Python 2.7 @ericof, @andreclimaco

## 4.0.0 (2021-04-28)

- BREAKING: Make changes for ES 7.x @bduncan137

- Slow down tests to allow them to complete correctly @bduncan137


## 3.0.5 (2021-04-28)

- [Issue #76](https://github.com/collective/collective.elasticsearch/issues/76) In 5.1+ we want to patch _unindexObject not unindexObject @ewohnlich

- Explicit error logging added, if ES bulk action for indexing failed. @nazrulworld

- Fix commit hook bug when content has been moved @instification


## 3.0.4 (2019-08-21)

- [Issue #63](https://github.com/collective/collective.elasticsearch/issues/63) Now ensuring unicode value would for both python2 and python3 case. @nazrulworld

- Now possible to search by other than `Title`, `Description` and `SearchableText` indexes. @nazrulworld


## 3.0.3 (2019-03-12)

- Add missing import logger @nazrulworld


## 3.0.2 (2019-01-31)

- Fix Zope DateTime convert to also handle the datetime.date type @ewohnlich


## 3.0.1 (2019-01-28)

- Fix sortable_title search issue @ewohnlich


## 3.0.0 (2019-01-28)

- Fix date queries to work with `min:max` as well as `minmax` @vangheem

- Fix sort order parsing and implementation @vangheem

- Handle upgrades with missing `es_only_indexes` properly @vangheem

- Add IReindexActive to request as a flag for other code @lucid-0


## 2.0.2 (2018-11-27)


- Python 3 Support @vangheem

- Support ES 6 @lucid-0

- Fix error causing "Server Status" on @@elastic-controlpanel to be empty. @fulv


## 2.0.1 (2018-01-05)

- Prevent critical error when by chance query value is None. @thomasdesvenain

- Minor code cleanup: readability, pep8, 80 cols, zca decorators. @jensens

- Fix date criteria: 'minmax' instead of 'min:max' + string to date conversion @ebrehault


## 2.0.0a6 (2017-03-29)

- Gracefully handle upgrades in the settings interface so it doesn't break for people upgrading. @vangheem


## 2.0.0a5 (2017-03-29)

- Running indexing as admin as it is possible to initiate reindex or index on an object that you do not have permissions for @vangheem


## 2.0.0a4 (2017-03-27)

- released


## 2.0.0a3 (2017-03-27)

- Add a method to set the body of the request during index creation. @Gagaro

- Fixed get brain in lazy list with negative indexes. @thomasdesvenain

- The list of indexes that forces es search is configurable. @thomasdesvenain

- Works under Plone 4.3. @thomasdesvenain

- Works with archetypes contents. @thomasdesvenain

## 2.0.0a2 (2016-07-19)

- We can pass a custom results factory and custom query parameters to IElasticSearchCatalog.search() method. So we can use it as a public interface for custom needs. @thomasdesvenain

- Prevent from unindex before reindex when uid is unchanged, for instance at rename. Use a set for to-remove list. @thomasdesvenain

- Fix indexing when removing the Title and Description indexes from Plone @vangheem

## 2.0.0a1 (2016-06-06)

- upgrade to elasticsearch 2.x @vangheem

## 1.0.1a4 (2016-05-22)

- provide better search query @vangheem

## 1.0.1a3 (2016-03-22)

- make sure to get alias definition right @vangheem

## 1.0.1a2 (2016-03-18)

- create index as an alias so you can potentially work on an existing alias without needing downtime @vangheem

## 1.0.1a1 (2016-02-25)

- change default sorting to descending. [Issue #12](https://github.com/collective/collective.elasticsearch/issues/12) @neilferreira

## 1.0.0a1 (2016-02-25)

- Initial release


