# Intersect statement in elasticsearch?

**URL:** https://discuss.elastic.co/t/intersect-statement-in-elasticsearch/21488
**Category:** Elasticsearch
**Created:** [January 5, 2015, 6:23pm UTC](https://discuss.elastic.co/t/intersect-statement-in-elasticsearch/21488 "2015-01-05T18:23:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![john\_nesh76](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@john\_nesh76](https://discuss.elastic.co/u/john_nesh76)
#### Post date: [January 5, 2015, 6:23pm UTC](https://discuss.elastic.co/t/intersect-statement-in-elasticsearch/21488/1 "2015-01-05T18:23:48Z")

</div>

Hi,

Is it possible to have an output from an intersection of data that are in  
two different index or field?  
Example:  
We have a list of botIP in elasticsearch and in another index where we  
capture data from firewall.

We want the list that match a predetermined field (example DST.IP) taken  
from the firewall (real time log) and botIP list (mostly static).

It is like a "real time" intersect in SQL.

INSERT INTO table\_a VALUES (1, 'A'), (2, 'B'), (3, 'B');INSERT INTO table\_b VALUES (1, 'B');  
SELECT value FROM table\_aINTERSECTSELECT value FROM table\_b

value-----  
B

John

--  
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/f40d3068-c1c2-47c3-b3ae-d709a9fe841e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f40d3068-c1c2-47c3-b3ae-d709a9fe841e%40googlegroups.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:40am UTC](https://discuss.elastic.co/t/intersect-statement-in-elasticsearch/21488/2 "2017-07-06T00:40:48Z")

</div>


