# Is field type "wildcard" supported in elasticsearch-spark?

**URL:** <https://discuss.elastic.co/t/is-field-type-wildcard-supported-in-elasticsearch-spark/275983>\
**Category:** Elasticsearch\
**Tags:** docker, es-hadoop\
**Created:** [June 15, 2021, 11:23am UTC](https://discuss.elastic.co/t/is-field-type-wildcard-supported-in-elasticsearch-spark/275983 "2021-06-15T11:23:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrxs](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@jrxs](https://discuss.elastic.co/u/jrxs)\
**Post date:** [June 15, 2021, 11:23am UTC](https://discuss.elastic.co/t/is-field-type-wildcard-supported-in-elasticsearch-spark/275983/1 "2021-06-15T11:23:34Z")

</div>

Hi,

I am currently doing some tests to see if I can use Apache Spark and the elasticsearch-spark (elasticsearch-hadoop) to analyse data that I have in elasticsearch.

I am testing using the following versions in a docker-compose setup:

Spark: 3.1.2  
Elasticsearch: 7.12.1

For the spark job its a java program using dependencies:

- spark-core\_2.12:3.1.2
- elasticsearch-spark-30\_2.12:7.13.2

I use spark-submit to send the application to spark.

In elasticsearch I have one (1) index where some different string fields are mapped. I have tested text, keyword and wildcard, however I am most interested in the wildcard variant because of its properties for efficient wildcard searches.

```auto
 ...
 "fielda" : { "type" : "keyword" },
 "fieldb" : { "type" : "wildcard" },
 ...

```

**Problem**  
Fields of type wildcard simply does not seem to exist when accessing the data through the JavaPairRDD in the spark job.

Examples:  
When I run the spark job and filters+counts all documents where fieldb is some value I get 0 hits although I know it should give 2 hits.  
I have tried using the same code but for fielda which is of type keyword and then the 2 hits are found.

Also, I have made a simple .first() to just get hold of first available indexed document and when I print all the entries in the associated key-value map any field that is of type wildcard just does not appear.

I have compared these results with the response when I use rest API to directly search elasticsearch and there I can see and search both keyword and wildcard fields, no problem.

Some questions of mine:

1. Is the wildcard field type not supported? And if not, anybody know if this feature is planned to be added soon in elasticsearch-hadoop/elasticsearch-spark?
2. Is there any way to get wildcard fields to work with elasticsearch-spark?

---

<div class="post-metadata">

**Author:** ![jrxs](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@jrxs](https://discuss.elastic.co/u/jrxs)\
**Post date:** [June 17, 2021, 7:41am UTC](https://discuss.elastic.co/t/is-field-type-wildcard-supported-in-elasticsearch-spark/275983/2 "2021-06-17T07:41:09Z")

</div>

Answer was had on github (wildcard field type is not yet supported):  
[https://github.com/elastic/elasticsearch-hadoop/issues/1697#issuecomment-862493404](https://github.com/elastic/elasticsearch-hadoop/issues/1697#issuecomment-862493404)

---

<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:** [July 15, 2021, 7:41am UTC](https://discuss.elastic.co/t/is-field-type-wildcard-supported-in-elasticsearch-spark/275983/3 "2021-07-15T07:41:39Z")

</div>

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