title: How do I compare two source IP from two different specific log in elastic search
body: <p>In Elasticsearch I want to compare two logs (<code>natlog</code> and <code>Gateway log</code>) with DSL Query.</p>
  <p>In nat log there is <code>srcip1</code> and In gateway log there is <code>srcip2</code></p>
  <p>I want to if this condition <code>srcip1 === srcip2</code> satisfied, <code>&quot;agent.id&quot;</code> display in result.</p>
  <p>On top of it I will put my already corelated query which I have made</p>
  <pre><code>{
    &quot;query&quot;: {
      &quot;bool&quot;: {
        &quot;should&quot;: [
          {
            &quot;match&quot;: {
              &quot;location&quot;: &quot;\\Users\\Saad\\Desktop\\nat.log&quot;
            }
          },
          {
            &quot;match&quot;: {
              &quot;location&quot;: &quot;\\Users\\Saad\\Desktop\\attendance-logs-with-ports.log&quot;
            }
          }
        ],
        &quot;must&quot;: [
          {
            &quot;term&quot;: {
              &quot;data.srcip&quot;: &quot;1.1.1.1&quot;
            }
          }
        ]
      }
    },
    &quot;fields&quot;: [
      &quot;data.srcip1&quot;
    ],
    &quot;_source&quot;: false
    
  }
  </code></pre>
  <p>I tried multiple things but not succeeded.</p>