Metadata-Version: 2.4
Name: urban-json-elastic
Version: 0.1.1
Summary: Plugin urban-json : recherche Elasticsearch (esconnect / essearch).
Author-email: Gael Beard <gaelgael5@gmail.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/gaelgael5/Jslt
Project-URL: Repository, https://github.com/gaelgael5/Jslt
Keywords: json,transform,template,jslt,elasticsearch,plugin
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: urban-json
Requires-Dist: elasticsearch>=8
Dynamic: license-file

# urban-json-elastic

*Français · [English](https://github.com/gaelgael5/Jslt/blob/main/packages/urban-json-elastic/README.en.md)*

Plugin [urban-json](https://github.com/gaelgael5/Jslt) : recherche **Elasticsearch**
depuis les templates, via le client officiel `elasticsearch`.

## Installation

```bash
pip install urban-json-elastic      # tire urban-json et le client elasticsearch
```

`urban-json` découvre le plugin automatiquement via les entry points (`urban_json.functions`).

## Utilisation

```python
from urban_json import JsltTemplate

tpl = JsltTemplate.parse('''
{
  "es:": esconnect("https://localhost:9200", $.api_key),
  "docs": [ {
    "$source": essearch(es:, "products", { "match": { "category": "book" } }, 50),
    "nom": $.title, "prix": $.price
  } ]
}
''')
```

- `esconnect(hosts, api_key, username, password, verify_certs)` → descripteur de
  connexion (à stocker dans une variable).
- `essearch(connection, index, query, size)` → liste des documents trouvés
  (le `_source` de chaque hit). `query` est une clause du DSL Elasticsearch
  (`match_all` si absente).

## Sécurité

`essearch` interroge un cluster Elasticsearch réel. Les identifiants (api_key /
mot de passe) transitent par le descripteur de connexion : traitez-les comme des
secrets côté template.

## Licence

Apache-2.0.
