# Comparing fields from input

**URL:** <https://discuss.elastic.co/t/comparing-fields-from-input/189246>\
**Category:** Logstash\
**Created:** [July 7, 2019, 12:51pm UTC](https://discuss.elastic.co/t/comparing-fields-from-input/189246 "2019-07-07T12:51:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uchiha\_Kakashi](https://avatars.discourse-cdn.com/v4/letter/u/ecae2f/32.png) [@Uchiha\_Kakashi](https://discuss.elastic.co/u/Uchiha_Kakashi)\
**Post date:** [July 7, 2019, 12:51pm UTC](https://discuss.elastic.co/t/comparing-fields-from-input/189246/1 "2019-07-07T12:51:38Z")

</div>

I have brought a json document from the index "sequence". I want to access one of the fields "value1" in that doc and compare.  
I am getting errors.  
My config file is --\>

\<  
input {  
elasticsearch {  
hosts =\> "localhost:9200"  
index =\> "sequence"  
tags =\> "booleans"  
}  
}

filter {  
mutate {  
if "value1" == "true" {  
# some operation .......  
}  
}  
}  
output {  
if "bools" in [tags] {  
stdout { codec =\> rubydebug }  
}  
}  
/\>

Can anyone tell me how can I do the comparison??  
Thank you in advance !!

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 7, 2019, 2:01pm UTC](https://discuss.elastic.co/t/comparing-fields-from-input/189246/2 "2019-07-07T14:01:05Z")

</div>

> [@Uchiha\_Kakashi](#):
>
> if "value1" == "true" {

"value1" refers to a string literal. To reference a field on an event use [value1]. "true" is also a string literal, if the field is actually a boolean then you should use

```
if [value1] == true {

```

---

<div class="post-metadata">

**Author:** ![Uchiha\_Kakashi](https://avatars.discourse-cdn.com/v4/letter/u/ecae2f/32.png) [@Uchiha\_Kakashi](https://discuss.elastic.co/u/Uchiha_Kakashi)\
**Post date:** [July 7, 2019, 2:35pm UTC](https://discuss.elastic.co/t/comparing-fields-from-input/189246/3 "2019-07-07T14:35:06Z")

</div>

Yes  
Thanks that worked !!

---

<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 4, 2019, 2:35pm UTC](https://discuss.elastic.co/t/comparing-fields-from-input/189246/4 "2019-08-04T14:35:14Z")

</div>

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