# How to enter Elastic JSON query in Kibana discover

**URL:** <https://discuss.elastic.co/t/how-to-enter-elastic-json-query-in-kibana-discover/142222>\
**Category:** Kibana\
**Created:** [July 30, 2018, 4:30pm UTC](https://discuss.elastic.co/t/how-to-enter-elastic-json-query-in-kibana-discover/142222 "2018-07-30T16:30:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dirri](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dirri](https://discuss.elastic.co/u/dirri)\
**Post date:** [July 30, 2018, 4:30pm UTC](https://discuss.elastic.co/t/how-to-enter-elastic-json-query-in-kibana-discover/142222/1 "2018-07-30T16:30:45Z")

</div>

I´m trying to use this one in Kibana discover but it expects some other format i think.  
Error: Discover: Expected "\*", ":", "\<", "\<=", "\>", "\>=", "", [\ \t\r\n] or end of input but """ found  
The query looks like this:

```
{ "size":0,
    "query": {
        "range": {
            "mainBattery": {
                "lte": 89,
                "gte": 80
            }
        }
    },
    "collapse": {
        "field": "mac.keyword"
    },
    "sort": [
        {
            "timestamp": "desc"
        }
    ],
    "aggs": {
        "result_count": {
            "cardinality": {
                "field": "mac.keyword"
            }
        }
    }
}

```

Is it possible? In other words how can i perform this query in discover ?`Later i want to use the query incl. aggs in Visualization.

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [July 30, 2018, 6:17pm UTC](https://discuss.elastic.co/t/how-to-enter-elastic-json-query-in-kibana-discover/142222/2 "2018-07-30T18:17:05Z")

</div>

Hey @dirri, you unfortunately can't directly input the Elasticsearch search syntax directly into Discover or Visualize. Using the "filter bar" at the top of both Visualize and Discover, you can input the filter:

```auto
"query": {
        "range": {
            "mainBattery": {
                "lte": 89,
                "gte": 80
            }
        }
    },

```

On Discover, this will show you all of the documents that match the specific filter.

And then if you switch over to Visualize, you can build the rest of the visualization using the cardinality aggregation.

---

<div class="post-metadata">

**Author:** ![dirri](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dirri](https://discuss.elastic.co/u/dirri)\
**Post date:** [July 30, 2018, 6:29pm UTC](https://discuss.elastic.co/t/how-to-enter-elastic-json-query-in-kibana-discover/142222/3 "2018-07-30T18:29:55Z")

</div>

Hi @Brandon_Kobel, thx for the reply but i didn't See the cardinality aggregation in visualize and i also need the collapsing and timstamp sorting to get desired result. Any idea?

---

<div class="post-metadata">

**Author:** ![dirri](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dirri](https://discuss.elastic.co/u/dirri)\
**Post date:** [July 30, 2018, 7:46pm UTC](https://discuss.elastic.co/t/how-to-enter-elastic-json-query-in-kibana-discover/142222/4 "2018-07-30T19:46:23Z")

</div>

Or am i missing something?

---

<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:** [August 27, 2018, 7:46pm UTC](https://discuss.elastic.co/t/how-to-enter-elastic-json-query-in-kibana-discover/142222/5 "2018-08-27T19:46:35Z")

</div>

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