# How do you search for many IP addresses and output only the source IP and destination IP in Dev Tools \[Kibana\]

**URL:** <https://discuss.elastic.co/t/how-do-you-search-for-many-ip-addresses-and-output-only-the-source-ip-and-destination-ip-in-dev-tools-kibana/276542>\
**Category:** Kibana\
**Created:** [June 21, 2021, 1:21pm UTC](https://discuss.elastic.co/t/how-do-you-search-for-many-ip-addresses-and-output-only-the-source-ip-and-destination-ip-in-dev-tools-kibana/276542 "2021-06-21T13:21:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kanrab](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@kanrab](https://discuss.elastic.co/u/kanrab)\
**Post date:** [June 21, 2021, 1:21pm UTC](https://discuss.elastic.co/t/how-do-you-search-for-many-ip-addresses-and-output-only-the-source-ip-and-destination-ip-in-dev-tools-kibana/276542/1 "2021-06-21T13:21:18Z")

</div>

So the query to search for a single IP is:

```auto
GET _search
{
  "query": {
    "term": {
      "ip_addr": "43.225.52.0/23"
      
    }
  }
}

```

But this is only able to search for one IP address  
My original query was:

```auto
GET _search 

{ 
   "query": { 
      "terms": { 
  	   "DestinationIP": [ 
    	      "100.42.74.212", 
    	      "101.50.1.23", 
    	      "101.99.90.41", 
    	      "103.114.160.253" 
  	      ] 
} 
   } 
} 

```

But this outputted everything when I was only interested in the associated source address and associated destination IP address. If any returned at all

How do I query for many IP addresses and output only the source IP and destination IP?

---

<div class="post-metadata">

**Author:** ![Mikhail\_Shustov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikhail_shustov/32/49186_2.png) [@Mikhail\_Shustov](https://discuss.elastic.co/u/Mikhail_Shustov)\
**Post date:** [June 22, 2021, 11:29am UTC](https://discuss.elastic.co/t/how-do-you-search-for-many-ip-addresses-and-output-only-the-source-ip-and-destination-ip-in-dev-tools-kibana/276542/2 "2021-06-22T11:29:38Z")

</div>

> [@kanrab](#):
>
> How do I query for many IP addresses and output only the source IP and destination IP?

Does the `fields` option cover your case? [Retrieve selected fields from a search | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-fields.html)

---

<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 20, 2021, 11:30am UTC](https://discuss.elastic.co/t/how-do-you-search-for-many-ip-addresses-and-output-only-the-source-ip-and-destination-ip-in-dev-tools-kibana/276542/3 "2021-07-20T11:30:14Z")

</div>

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