# Limit query to field

**URL:** <https://discuss.elastic.co/t/limit-query-to-field/199204>\
**Category:** Elasticsearch\
**Created:** [September 12, 2019, 8:44am UTC](https://discuss.elastic.co/t/limit-query-to-field/199204 "2019-09-12T08:44:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Escalus](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@Escalus](https://discuss.elastic.co/u/Escalus)\
**Post date:** [September 12, 2019, 8:44am UTC](https://discuss.elastic.co/t/limit-query-to-field/199204/1 "2019-09-12T08:44:13Z")

</div>

Hello,  
I have an index with document and organizations who published this documents. One document can have multiple organizations.

"organization" : [  
"Carnegie Mellon Univ, Dept Mat Sci & Engn",  
"US Steel Corp, US Steel Res & Technol Ctr",  
"Alcoa Technical Ctr, Div Mat Sci"  
]

"query\_string": {  
"query": "Technical Res",  
"default\_operator": "AND",  
"fields": [  
"organization"  
]  
}

My problem is that query\_string finds documents where the terms are distributed over all organizations.  
How can I limit the search to only find the documents where all terms are in the same "subfield"?

Frank

---

<div class="post-metadata">

**Author:** ![wangqinghuan](https://avatars.discourse-cdn.com/v4/letter/w/d26b3c/32.png) [@wangqinghuan](https://discuss.elastic.co/u/wangqinghuan)\
**Post date:** [September 12, 2019, 9:24am UTC](https://discuss.elastic.co/t/limit-query-to-field/199204/2 "2019-09-12T09:24:18Z")

</div>

Yes, this is a problem that nested document can solve. You can store each orgnization as a independent child document and you query\_string can be limited to each independent child document.

---

<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:** [October 10, 2019, 9:38am UTC](https://discuss.elastic.co/t/limit-query-to-field/199204/3 "2019-10-10T09:38:15Z")

</div>

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