# Find out which terms were not found

**URL:** <https://discuss.elastic.co/t/find-out-which-terms-were-not-found/79628>\
**Category:** Elasticsearch\
**Created:** [March 22, 2017, 5:29pm UTC](https://discuss.elastic.co/t/find-out-which-terms-were-not-found/79628 "2017-03-22T17:29:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunde](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@kunde](https://discuss.elastic.co/u/kunde)\
**Post date:** [March 22, 2017, 5:29pm UTC](https://discuss.elastic.co/t/find-out-which-terms-were-not-found/79628/1 "2017-03-22T17:29:55Z")

</div>

Is there a way to know which terms were not found?

If I have something like this:

```
"filter":{  
    "terms":{  
          "productNo":[ 
               "1234567890", "0987654321"
          ]
    }
 }

```

and I got results for 1234567890, but not for 0987654321, how can I know that?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 22, 2017, 6:06pm UTC](https://discuss.elastic.co/t/find-out-which-terms-were-not-found/79628/2 "2017-03-22T18:06:16Z")

</div>

You can potentially do that by using instead a bool query with should clauses.  
Use then term queries (instead of terms query) and use named queries feature.

The result will come back with queries which matched. Just "negate" that result in your application.

My 2 cents

---

<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:** [April 19, 2017, 6:06pm UTC](https://discuss.elastic.co/t/find-out-which-terms-were-not-found/79628/3 "2017-04-19T18:06:21Z")

</div>

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