# How to use x-pack with python to enable wildcard

**URL:** <https://discuss.elastic.co/t/how-to-use-x-pack-with-python-to-enable-wildcard/290941>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [December 4, 2021, 3:35am UTC](https://discuss.elastic.co/t/how-to-use-x-pack-with-python-to-enable-wildcard/290941 "2021-12-04T03:35:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mujo](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@Mujo](https://discuss.elastic.co/u/Mujo)\
**Post date:** [December 4, 2021, 3:35am UTC](https://discuss.elastic.co/t/how-to-use-x-pack-with-python-to-enable-wildcard/290941/1 "2021-12-04T03:35:39Z")

</div>

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](http://localhost:9200)')

XPackClient.infect\_client(es)

def indexing(file\_dir):  
mapping = {  
"mappings": {  
"properties":{  
"text": {"type": "text"},  
"parsed\_text": {"type": "wildcard"}  
}  
}  
}  
print(INDEX\_NAME)  
es.indices.create(index=INDEX\_NAME, body=mapping)

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

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [December 4, 2021, 7:29am UTC](https://discuss.elastic.co/t/how-to-use-x-pack-with-python-to-enable-wildcard/290941/2 "2021-12-04T07:29:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 1, 2022, 7:30am UTC](https://discuss.elastic.co/t/how-to-use-x-pack-with-python-to-enable-wildcard/290941/3 "2022-01-01T07:30:15Z")

</div>

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