# Query on fieldname with wildcard?

**URL:** <https://discuss.elastic.co/t/query-on-fieldname-with-wildcard/157569>\
**Category:** Elasticsearch\
**Created:** [November 20, 2018, 2:35pm UTC](https://discuss.elastic.co/t/query-on-fieldname-with-wildcard/157569 "2018-11-20T14:35:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![boeledi01](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@boeledi01](https://discuss.elastic.co/u/boeledi01)\
**Post date:** [November 20, 2018, 2:35pm UTC](https://discuss.elastic.co/t/query-on-fieldname-with-wildcard/157569/1 "2018-11-20T14:35:59Z")

</div>

Hi,

In order to support multi-lingual documents, we stored them with the suffix of the language code, such as:  
{  
"description\_EN": "My Description",  
"description\_FR": "Ma Description"  
}

We do not know in advance, in which language(s) documents are generated and we support up to 24 languages. Mappings for the 24 languages were created.

Therefore my question:

How can I run a query against all documents, not knowing the "field name" **suffix**?

I would need something like;

..."wildcard": {  
"description\_\*.keyword": {  
"wildcard": "_a_"  
}  
}

but this does not work...

Any help would be more than welcome.

Many thanks in advance,

---

<div class="post-metadata">

**Author:** ![byronvoorbach](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/byronvoorbach/32/8283_2.png) [@byronvoorbach](https://discuss.elastic.co/u/byronvoorbach)\
**Post date:** [November 20, 2018, 2:49pm UTC](https://discuss.elastic.co/t/query-on-fieldname-with-wildcard/157569/2 "2018-11-20T14:49:43Z")

</div>

One way which could work is using the [query\_string](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html) / [simple\_query\_string](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html) query.

```
{
  "query": {
    "query_string": {
      "query": "a*",
      "fields": [
          "description_*"
        ]
    }
  }
}

```

They allow wildcards in both field names and query terms

---

<div class="post-metadata">

**Author:** ![boeledi01](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@boeledi01](https://discuss.elastic.co/u/boeledi01)\
**Post date:** [November 20, 2018, 2:57pm UTC](https://discuss.elastic.co/t/query-on-fieldname-with-wildcard/157569/3 "2018-11-20T14:57:26Z")

</div>

thank you so much. It works !! 🙂

---

<div class="post-metadata">

**Author:** ![byronvoorbach](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/byronvoorbach/32/8283_2.png) [@byronvoorbach](https://discuss.elastic.co/u/byronvoorbach)\
**Post date:** [November 20, 2018, 2:59pm UTC](https://discuss.elastic.co/t/query-on-fieldname-with-wildcard/157569/4 "2018-11-20T14:59:26Z")

</div>

Cool! 😃 happy coding

---

<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:** [December 18, 2018, 2:59pm UTC](https://discuss.elastic.co/t/query-on-fieldname-with-wildcard/157569/5 "2018-12-18T14:59:39Z")

</div>

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