# Int Array INTERSECT filter - performance boosting?

**URL:** https://discuss.elastic.co/t/int-array-intersect-filter-performance-boosting/71622
**Category:** Elasticsearch
**Created:** [January 14, 2017, 7:17pm UTC](https://discuss.elastic.co/t/int-array-intersect-filter-performance-boosting/71622 "2017-01-14T19:17:53Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![BarrelRoll](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/barrelroll/32/14572_2.png) [@BarrelRoll](https://discuss.elastic.co/u/BarrelRoll)
#### Post date: [January 14, 2017, 7:17pm UTC](https://discuss.elastic.co/t/int-array-intersect-filter-performance-boosting/71622/1 "2017-01-14T19:17:53Z")

</div>

(The question is somewhat related to [Array intersect filter?](https://discuss.elastic.co/t/array-intersect-filter/11100))

Given an array of integers on each document in ESDB I want to pull only documents that have any of the query input values - so it's basically INTERSECT/CONTAINS query.

My question is: can the index be optimized for this sort of INTERSECT search? Any analyzer tuning? Or maybe changing ordering of the values?

Perhaps there's a more efficient way to query? This is the way I filter at the moment:

"query": {  
"filtered": {  
"filter": {  
"bool": {  
"should": [  
{  
"terms": {  
"array\_of\_ints\_field": [  
1,  
2,  
3,  
4  
]  
}  
}  
]  
}  
}  
}  
}

Many thanks in advance!

---

<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 11, 2017, 7:17pm UTC](https://discuss.elastic.co/t/int-array-intersect-filter-performance-boosting/71622/2 "2017-02-11T19:17:53Z")

</div>

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