# Search within array

**URL:** https://discuss.elastic.co/t/search-within-array/21856
**Category:** Elasticsearch
**Created:** [January 27, 2015, 8:57pm UTC](https://discuss.elastic.co/t/search-within-array/21856 "2015-01-27T20:57:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![roger](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@roger](https://discuss.elastic.co/u/roger)
#### Post date: [January 27, 2015, 8:57pm UTC](https://discuss.elastic.co/t/search-within-array/21856/1 "2015-01-27T20:57:13Z")

</div>

I'm searching on an array of objects

The problem is when I search using query string  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-dsl-query-string-query](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-dsl-query-string-query),  
it matches the text split in different objects (different array positions).  
Is there a way to avoid this behavior and search the query string within  
the same array position?

I know that I could index the field with a high position\_offset\_gap and  
search using phrase, but I don't need the text to be in order, only within  
the same array position

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAJp2531wF4r09FHHcWOLVcU5V4O\_p%2BCGEpqGBkto37ic3oe0Pg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJp2531wF4r09FHHcWOLVcU5V4O_p%2BCGEpqGBkto37ic3oe0Pg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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: [July 6, 2017, 12:36am UTC](https://discuss.elastic.co/t/search-within-array/21856/2 "2017-07-06T00:36:19Z")

</div>


