# Using "constant\_score" queries in Kibana

**URL:** <https://discuss.elastic.co/t/using-constant-score-queries-in-kibana/22817>\
**Category:** Elasticsearch\
**Created:** [March 23, 2015, 10:50am UTC](https://discuss.elastic.co/t/using-constant-score-queries-in-kibana/22817 "2015-03-23T10:50:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ole\_Hedegaard](https://avatars.discourse-cdn.com/v4/letter/o/4491bb/32.png) [@Ole\_Hedegaard](https://discuss.elastic.co/u/Ole_Hedegaard)\
**Post date:** [March 23, 2015, 10:50am UTC](https://discuss.elastic.co/t/using-constant-score-queries-in-kibana/22817/1 "2015-03-23T10:50:05Z")

</div>

Hi,

I'm looking for a way to query ES from Kibana with a "constant\_score" query  
(see eg.  
[http://elasticsearch-users.115913.n3.nabble.com/exists-filter-td4047532.html](http://elasticsearch-users.115913.n3.nabble.com/exists-filter-td4047532.html)).  
The reason is that I have a lot of JSON data in ES in this format (sensor  
readings/timestamps):

{"timestamp":"2015-03-23T10:39:35.346Z",  
"sensor-1643":42,"sensor-1643\_ts":1427107007585,  
"sensor-1583":17,"sensor-1583\_ts":1427106972603,  
"sensor-1581":-1,"sensor-1581\_ts":1427106985593,  
"sensor-1578":-3,"sensor-1578\_ts":1427106986940,  
"sensor-1645":0,"sensor-1645\_ts":1427107009517,  
"sensor-1574":38,"sensor-1574\_ts":1427106970044,  
"sensor-1635":600,"sensor-1635\_ts":1427106996913,  
...}

- and I want to search for the documents that contain readings for a  
specific sensor, eg. "sensor-1643".

With a "constant\_score" query, I can query ES directly like this:

{  
"constant\_score" : {  
"filter" : {  
"exists" : { "field" : "sensor-1643"}  
},  
}  
}

But is there any way of doing that through Kibana? Searching seems only to  
regard value fields...

Thanks,  
Ole Hedegaard

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9d2ec524-8850-44a3-8ff4-61b9a75906a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9d2ec524-8850-44a3-8ff4-61b9a75906a3%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ole\_Hedegaard](https://avatars.discourse-cdn.com/v4/letter/o/4491bb/32.png) [@Ole\_Hedegaard](https://discuss.elastic.co/u/Ole_Hedegaard)\
**Post date:** [March 23, 2015, 6:36pm UTC](https://discuss.elastic.co/t/using-constant-score-queries-in-kibana/22817/2 "2015-03-23T18:36:05Z")

</div>

Ok, I found out myself. It is possible to use _exists_ like this:

_exists_:"sensor-1643"

Den mandag den 23. marts 2015 kl. 11.50.05 UTC+1 skrev Ole Hedegaard:

> Hi,
> 
> I'm looking for a way to query ES from Kibana with a "constant\_score"  
> query (see eg.  
> [http://elasticsearch-users.115913.n3.nabble.com/exists-filter-td4047532.html](http://elasticsearch-users.115913.n3.nabble.com/exists-filter-td4047532.html)).  
> The reason is that I have a lot of JSON data in ES in this format (sensor  
> readings/timestamps):
> 
> {"timestamp":"2015-03-23T10:39:35.346Z",  
> "sensor-1643":42,"sensor-1643\_ts":1427107007585,  
> "sensor-1583":17,"sensor-1583\_ts":1427106972603,  
> "sensor-1581":-1,"sensor-1581\_ts":1427106985593,  
> "sensor-1578":-3,"sensor-1578\_ts":1427106986940,  
> "sensor-1645":0,"sensor-1645\_ts":1427107009517,  
> "sensor-1574":38,"sensor-1574\_ts":1427106970044,  
> "sensor-1635":600,"sensor-1635\_ts":1427106996913,  
> ...}
> 
> - and I want to search for the documents that contain readings for a  
> specific sensor, eg. "sensor-1643".
> 
> With a "constant\_score" query, I can query ES directly like this:
> 
> {  
> "constant\_score" : {  
> "filter" : {  
> "exists" : { "field" : "sensor-1643"}  
> },  
> }  
> }
> 
> But is there any way of doing that through Kibana? Searching seems only to  
> regard value fields...
> 
> Thanks,  
> Ole Hedegaard

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/074996d8-60f9-4eb6-8ac1-ecfa8f94872a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/074996d8-60f9-4eb6-8ac1-ecfa8f94872a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:24am UTC](https://discuss.elastic.co/t/using-constant-score-queries-in-kibana/22817/3 "2017-07-06T00:24:44Z")

</div>


