# Logstash crashes with "comparison of String with 0 failed"

**URL:** https://discuss.elastic.co/t/logstash-crashes-with-comparison-of-string-with-0-failed/176516
**Category:** Logstash
**Created:** [April 12, 2019, 12:48am UTC](https://discuss.elastic.co/t/logstash-crashes-with-comparison-of-string-with-0-failed/176516 "2019-04-12T00:48:07Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![reswob](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/reswob/32/38015_2.png) [@reswob](https://discuss.elastic.co/u/reswob)
#### Post date: [April 22, 2019, 7:43pm UTC](https://discuss.elastic.co/t/logstash-crashes-with-comparison-of-string-with-0-failed/176516/2 "2019-04-22T19:43:00Z")

</div>

OK, I've been working on this for a while with tech support and my own testing. Here is the current situation:  
Upgraded to LS 7.0  
That changed the error above to 'no implicit conversion of nil into Integer'  
But either way, I've narrowed the error down to below:

For THIS function:

```
         if [site_rank] and [site_rank]!="" and [site_rank] &gt; 0 {

                  mutate {

                          add_tag =&gt; ["top1M"]

                  }

          }

```

if the site\_rank field has NOT been populated for some reason, I get the 'no implicit conversion of nil into Integer' error. And the conditional statements above do not seem to prevent the error.

Also tried

```
     if [site_rank] and [site_rank]!="" {

           if [site_rank] &gt; 0 {

              mutate {

                      add_tag =&gt; ["top1M"]

              }

           }

      }

```

So, how do I check to see if site\_rank is nil?  
Is this the solution: [Logstash convert Nil values into a number](https://discuss.elastic.co/t/logstash-convert-nil-values-into-a-number/104271)

---

_[View the full topic](https://discuss.elastic.co/t/logstash-crashes-with-comparison-of-string-with-0-failed/176516)._
