# Kibana query for special character in KQL

**URL:** https://discuss.elastic.co/t/kibana-query-for-special-character-in-kql/224253
**Category:** Kibana
**Tags:** kql-kibana-query-language
**Created:** [March 19, 2020, 11:04am UTC](https://discuss.elastic.co/t/kibana-query-for-special-character-in-kql/224253 "2020-03-19T11:04:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![lusynda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lusynda/32/53557_2.png) [@lusynda](https://discuss.elastic.co/u/lusynda)
#### Post date: [March 19, 2020, 11:04am UTC](https://discuss.elastic.co/t/kibana-query-for-special-character-in-kql/224253/1 "2020-03-19T11:04:33Z")

</div>

Dear all  
I have a question using the KQL to query for special char in kibana  
it is like this, i have 2 data that have 2 field like this "test test" and "TEST+TEST"

when i type to query for "test test" it match both the "test test" and "TEST+TEST"

Is there a way to query for "test test" only or to discard the + in the query in kibana KQL

thank for your time

---

<div class="post-metadata">

### Author: ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)
#### Post date: [March 19, 2020, 1:54pm UTC](https://discuss.elastic.co/t/kibana-query-for-special-character-in-kql/224253/2 "2020-03-19T13:54:27Z")

</div>

@lusynda, the easiest way to do this would probably run this search on the keyword field. on analyzed fields, it will use the inverted index, where you lose some of the exact context.

so e.g.: if you create this index dev-console:

```auto
PUT foobar

PUT foobar/_doc/0
{
  "prop": "test test"
}

PUT foobar/_doc/1
{
  "prop": "TEST+TEST"
}

```

You can these exact match searches

`prop.keyword :TEST+*` =\> matches `TEST+TEST`  
`prop.keyword :"test test"` =\> matches `test test`  
`prop,keyword:"TEST+TEST"` =\> matches `TEST+TEST`

---

<div class="post-metadata">

### Author: ![lusynda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lusynda/32/53557_2.png) [@lusynda](https://discuss.elastic.co/u/lusynda)
#### Post date: [March 20, 2020, 1:23am UTC](https://discuss.elastic.co/t/kibana-query-for-special-character-in-kql/224253/3 "2020-03-20T01:23:24Z")

</div>

thank you for your response  
Yes well but the problems is that the doc that i have, in front of the word "test test" there are a bunch of random string, there is really no way for me to know what string is it so that why i couldnt use the keyword to query.  
Are there any thing that could help me?

---

<div class="post-metadata">

### Author: ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)
#### Post date: [March 20, 2020, 3:10am UTC](https://discuss.elastic.co/t/kibana-query-for-special-character-in-kql/224253/4 "2020-03-20T03:10:49Z")

</div>

thanks for info, makes sense.

Wildcard searches don't work at the beginning of the string when using the Lucene or KQL query syntax ([https://lucene.apache.org/core/2\_9\_4/queryparsersyntax.html#Wildcard%20Searches](https://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Wildcard%20Searches)). It's a limitation of the language.

You could do regex searches directly against Elasticsearch using the query-DSL ([https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html)), which would allow this, but this is not directly supported in the Kibana UI.

---

<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 17, 2020, 3:10am UTC](https://discuss.elastic.co/t/kibana-query-for-special-character-in-kql/224253/5 "2020-04-17T03:10:55Z")

</div>

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