# Searching inside an array of strings

**URL:** <https://discuss.elastic.co/t/searching-inside-an-array-of-strings/75463>\
**Category:** Elasticsearch\
**Created:** [February 17, 2017, 9:25am UTC](https://discuss.elastic.co/t/searching-inside-an-array-of-strings/75463 "2017-02-17T09:25:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tartuga](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tartuga/32/15084_2.png) [@Tartuga](https://discuss.elastic.co/u/Tartuga)\
**Post date:** [February 17, 2017, 9:25am UTC](https://discuss.elastic.co/t/searching-inside-an-array-of-strings/75463/1 "2017-02-17T09:25:20Z")

</div>

Searching inside an array of strings, i.e.:

{  
"ingredients" : ["grilled cheese", "pork", "ketchup"]  
}

query:

{  
"match" : {  
"cities" : {  
"query" : "grilled pork",  
"operator" : "and"  
}  
}  
}

Query return the element, because tokens "grilled" and "pork" are both present inside ingredients.  
The desidered behaviour is to match the document only if all the words in the query are present inside a single string of the array (not necessarily an exact match, it should match "grilled pork ribs" also, for example).  
How can I obtain this?

---

<div class="post-metadata">

**Author:** ![Tartuga](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tartuga/32/15084_2.png) [@Tartuga](https://discuss.elastic.co/u/Tartuga)\
**Post date:** [February 17, 2017, 1:21pm UTC](https://discuss.elastic.co/t/searching-inside-an-array-of-strings/75463/2 "2017-02-17T13:21:40Z")

</div>

[https://www.elastic.co/guide/en/elasticsearch/guide/current/\_multivalue\_fields\_2.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/_multivalue_fields_2.html)

This solve my problem, but I cannot figure out how to set "position\_increment\_gap" mapping using spring data in a java bean.

---

<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 17, 2017, 1:21pm UTC](https://discuss.elastic.co/t/searching-inside-an-array-of-strings/75463/3 "2017-03-17T13:21:55Z")

</div>

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