# Can I search elastic keys with wildcard or substring

**URL:** <https://discuss.elastic.co/t/can-i-search-elastic-keys-with-wildcard-or-substring/324754>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [February 6, 2023, 5:16am UTC](https://discuss.elastic.co/t/can-i-search-elastic-keys-with-wildcard-or-substring/324754 "2023-02-06T05:16:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarthik](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@sarthik](https://discuss.elastic.co/u/sarthik)\
**Post date:** [February 6, 2023, 5:16am UTC](https://discuss.elastic.co/t/can-i-search-elastic-keys-with-wildcard-or-substring/324754/1 "2023-02-06T05:16:41Z")

</div>

I have the following patterns as keys in my data stored in elk indexes:

```auto
* Name
* _name
* preffered_name
* first_name
* last_name

```

I need to query these keys, but the key names are not fixed, so need to search keys based on substring or wildcard _ **"name"** _, Is there any query which can help in reteiving values of these type of keys.

Thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 6, 2023, 6:32am UTC](https://discuss.elastic.co/t/can-i-search-elastic-keys-with-wildcard-or-substring/324754/2 "2023-02-06T06:32:15Z")

</div>

FWIW the Elasticsearch terminology is fields, not keys, so field-value pairs. I know json is key-value, which is kinda confusing 🙂

[Query string query | Elasticsearch Guide [8.6] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html) should do that as you can use wildcards with it for the field names you are querying.

---

<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:** [March 6, 2023, 6:32am UTC](https://discuss.elastic.co/t/can-i-search-elastic-keys-with-wildcard-or-substring/324754/3 "2023-03-06T06:32:45Z")

</div>

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