# Query against a list of objects

**URL:** <https://discuss.elastic.co/t/query-against-a-list-of-objects/83718>\
**Category:** Elasticsearch\
**Created:** [April 26, 2017, 2:36pm UTC](https://discuss.elastic.co/t/query-against-a-list-of-objects/83718 "2017-04-26T14:36:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kernelpanic](https://avatars.discourse-cdn.com/v4/letter/k/c89c15/32.png) [@kernelpanic](https://discuss.elastic.co/u/kernelpanic)\
**Post date:** [April 26, 2017, 2:36pm UTC](https://discuss.elastic.co/t/query-against-a-list-of-objects/83718/1 "2017-04-26T14:36:04Z")

</div>

Hello, we're currently using winlogbeat to send domain controller logs to Elasticsearch and I was wondering how I would query against a list of objects, for example a list of usernames. After looking into it I think I need to so something with 'terms queries' ([https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html))

I did create a document with a list of usernames but couldn't figure out how to query against it, particularly whilst using Kibana with the winlogbeat-\* index pattern - can anyone help with this?

Thanks.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [April 26, 2017, 2:55pm UTC](https://discuss.elastic.co/t/query-against-a-list-of-objects/83718/2 "2017-04-26T14:55:23Z")

</div>

I'm not sure about kibana, but you shouldn't need to create a document. You can use the list of terms.

If the list is short (like, less than 100) it is probably just fine to do a bunch of term queries in a `should` clause in a `bool` query. If you use the query\_string query (which I think kibana does in that big text box) that'd look like `(field:value | field:value | field:value)`.

---

<div class="post-metadata">

**Author:** ![kernelpanic](https://avatars.discourse-cdn.com/v4/letter/k/c89c15/32.png) [@kernelpanic](https://discuss.elastic.co/u/kernelpanic)\
**Post date:** [April 26, 2017, 3:15pm UTC](https://discuss.elastic.co/t/query-against-a-list-of-objects/83718/3 "2017-04-26T15:15:53Z")

</div>

Thanks for getting back to me; yes I suppose I could just create a list of query terms in the text box and save it. Just for the future though in case I do need to query against a large list of objects in a document, can you give me an example of such a query?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [April 26, 2017, 3:44pm UTC](https://discuss.elastic.co/t/query-against-a-list-of-objects/83718/4 "2017-04-26T15:44:03Z")

</div>

The Elasticsearch example is at the bottom of the page you linked. I'm not sure about kibana, sorry!

---

<div class="post-metadata">

**Author:** ![kernelpanic](https://avatars.discourse-cdn.com/v4/letter/k/c89c15/32.png) [@kernelpanic](https://discuss.elastic.co/u/kernelpanic)\
**Post date:** [April 26, 2017, 3:51pm UTC](https://discuss.elastic.co/t/query-against-a-list-of-objects/83718/5 "2017-04-26T15:51:26Z")

</div>

No worries thanks for getting back to me.

---

<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:** [May 24, 2017, 4:05pm UTC](https://discuss.elastic.co/t/query-against-a-list-of-objects/83718/6 "2017-05-24T16:05:16Z")

</div>

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