# Exclude some words with query in timelion

**URL:** https://discuss.elastic.co/t/exclude-some-words-with-query-in-timelion/148725
**Category:** Kibana
**Tags:** timelion
**Created:** [September 15, 2018, 10:04pm UTC](https://discuss.elastic.co/t/exclude-some-words-with-query-in-timelion/148725 "2018-09-15T22:04:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Gosforth](https://avatars.discourse-cdn.com/v4/letter/g/f08c70/32.png) [@Gosforth](https://discuss.elastic.co/u/Gosforth)
#### Post date: [September 15, 2018, 10:04pm UTC](https://discuss.elastic.co/t/exclude-some-words-with-query-in-timelion/148725/1 "2018-09-15T22:04:33Z")

</div>

How can I exclude some docs in timelion syntax?  
I want 3 first managers but not John Doe (even if he is in top 3)

`.es(index=some_index*, timefield=order_date, split=account_manager.keyword:3, q="NOT account_manager.keyword:John Doe")`

The syntax above does something opposite than it suppose to - it removes others and display only John Doe.

---

<div class="post-metadata">

### Author: ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)
#### Post date: [September 19, 2018, 4:38pm UTC](https://discuss.elastic.co/t/exclude-some-words-with-query-in-timelion/148725/2 "2018-09-19T16:38:59Z")

</div>

You're going to want to use [query string](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html) syntax:

`q='!account_manager.keyword:"John Doe"'`

---

<div class="post-metadata">

### Author: ![Gosforth](https://avatars.discourse-cdn.com/v4/letter/g/f08c70/32.png) [@Gosforth](https://discuss.elastic.co/u/Gosforth)
#### Post date: [September 19, 2018, 6:43pm UTC](https://discuss.elastic.co/t/exclude-some-words-with-query-in-timelion/148725/3 "2018-09-19T18:43:29Z")

</div>

> [@lukas](#):
>
> q='!account\_manager.keyword:"John Doe"'

Thank you very much!  
" The familiar boolean operators `AND` , `OR` and `NOT` (also written `&&` , `||` and `!` ) are also supported" so 'NOT' should work... but it does not.

---

<div class="post-metadata">

### Author: ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)
#### Post date: [September 19, 2018, 9:07pm UTC](https://discuss.elastic.co/t/exclude-some-words-with-query-in-timelion/148725/4 "2018-09-19T21:07:44Z")

</div>

I think what was actually wrong was that you hadn't quoted John Doe. The following would probably also work:

`q='NOT account_manager.keyword:"John Doe"'`

---

<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 17, 2018, 9:07pm UTC](https://discuss.elastic.co/t/exclude-some-words-with-query-in-timelion/148725/5 "2018-10-17T21:07:47Z")

</div>

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