# How to restrict search to selected fields when using q param

**URL:** https://discuss.elastic.co/t/how-to-restrict-search-to-selected-fields-when-using-q-param/323263
**Category:** Elasticsearch
**Created:** [January 16, 2023, 3:21pm UTC](https://discuss.elastic.co/t/how-to-restrict-search-to-selected-fields-when-using-q-param/323263 "2023-01-16T15:21:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![nn14](https://avatars.discourse-cdn.com/v4/letter/n/9e8a1a/32.png) [@nn14](https://discuss.elastic.co/u/nn14)
#### Post date: [January 16, 2023, 3:21pm UTC](https://discuss.elastic.co/t/how-to-restrict-search-to-selected-fields-when-using-q-param/323263/1 "2023-01-16T15:21:44Z")

</div>

Hi team,

Our users generally use `q` param to search people. E.g. `q="Matthew North"` or just `q="North"`. This results in our ES searching across all our 100+ fields defined in the schema and chances are it returns even those users who have region="North America". How do I restrict my search in such a case where we can limit the search only to firstName, lastName, middleName instead of all 100+ fields

---

<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: [January 17, 2023, 9:17am UTC](https://discuss.elastic.co/t/how-to-restrict-search-to-selected-fields-when-using-q-param/323263/2 "2023-01-17T09:17:42Z")

</div>

What version of Elasticsearch are you using?

---

<div class="post-metadata">

### Author: ![nn14](https://avatars.discourse-cdn.com/v4/letter/n/9e8a1a/32.png) [@nn14](https://discuss.elastic.co/u/nn14)
#### Post date: [January 17, 2023, 9:58am UTC](https://discuss.elastic.co/t/how-to-restrict-search-to-selected-fields-when-using-q-param/323263/3 "2023-01-17T09:58:26Z")

</div>

We are using Elasticsearch 7.10.0. Sorry forgot to mention that earlier.

---

<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 17, 2023, 9:58am UTC](https://discuss.elastic.co/t/how-to-restrict-search-to-selected-fields-when-using-q-param/323263/4 "2023-01-17T09:58:26Z")

</div>

Elasticsearch 7.10 is [EOL](https://www.elastic.co/support/eol) and no longer supported. Please upgrade ASAP.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

---

<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: [February 14, 2023, 9:59am UTC](https://discuss.elastic.co/t/how-to-restrict-search-to-selected-fields-when-using-q-param/323263/5 "2023-02-14T09:59:05Z")

</div>

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