How to use x-pack with python to enable wildcard

I need to set "type" : "wildcard" in mappings.
I have learnt that wildcard is added as a new feature to Elasticsearch 7.9.
However, I need to use x-pack in order to use this feature.
There are limited documents for learning how to use x-pack.
Can someone help to with it?
Thanks in advance!!

from Elasticsearch import Elasticsearch

from elasticsearch_xpack import XPackClient

es = Elasticsearch('http://localhost:9200')


def indexing(file_dir):
mapping = {
"mappings": {
"text": {"type": "text"},
"parsed_text": {"type": "wildcard"}
es.indices.create(index=INDEX_NAME, body=mapping)

The above code issues error:
"No handler for type [wildcard] declared on field"

You do need to install the default distribution of Elasticsearch, and I would recommend going with the latest version. This will give you access to the wildcard field type through the free Basic license automatically. You then create an index template and reindex your documents into an index that use this new template.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.