# Query script for postfix queue id groupping

**URL:** <https://discuss.elastic.co/t/query-script-for-postfix-queue-id-groupping/249512>\
**Category:** Kibana\
**Created:** [September 22, 2020, 12:05pm UTC](https://discuss.elastic.co/t/query-script-for-postfix-queue-id-groupping/249512 "2020-09-22T12:05:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![diecode](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@diecode](https://discuss.elastic.co/u/diecode)\
**Post date:** [September 22, 2020, 12:05pm UTC](https://discuss.elastic.co/t/query-script-for-postfix-queue-id-groupping/249512/1 "2020-09-22T12:05:23Z")

</div>

Hey,

I created ELK stack, and I saving postfix logs into an index. I created grok patters for mail\_from, mail\_to and queue\_id so I store them in fields. When I'm searching a mail\_from or mail\_to, I need copy the queue\_id and search again. Can I create a query that when I search a mail\_from and mail\_to then search automatic the queue\_id? How?

Thanks!

---

<div class="post-metadata">

**Author:** ![Bamieh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bamieh/32/38730_2.png) [@Bamieh](https://discuss.elastic.co/u/Bamieh)\
**Post date:** [September 22, 2020, 12:25pm UTC](https://discuss.elastic.co/t/query-script-for-postfix-queue-id-groupping/249512/2 "2020-09-22T12:25:50Z")

</div>

Hello,

Can you clarify what queries you are running at the moment? And what exactly you are trying to resolve?

---

<div class="post-metadata">

**Author:** ![diecode](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@diecode](https://discuss.elastic.co/u/diecode)\
**Post date:** [September 23, 2020, 5:40am UTC](https://discuss.elastic.co/t/query-script-for-postfix-queue-id-groupping/249512/3 "2020-09-23T05:40:29Z")

</div>

I haven't any query yet.

I am searching the best practice for this. Query? Nested fields? I don't know what is the best solution.

I would like grouping logs by queue\_id, when I search mail\_from and mail\_to fields.

---

<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:** [October 21, 2020, 5:40am UTC](https://discuss.elastic.co/t/query-script-for-postfix-queue-id-groupping/249512/4 "2020-10-21T05:40:35Z")

</div>

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