# Conditionals in filter clause

**URL:** <https://discuss.elastic.co/t/conditionals-in-filter-clause/169238>\
**Category:** Logstash\
**Created:** [February 20, 2019, 3:17pm UTC](https://discuss.elastic.co/t/conditionals-in-filter-clause/169238 "2019-02-20T15:17:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![humartinez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/humartinez/32/46395_2.png) [@humartinez](https://discuss.elastic.co/u/humartinez)\
**Post date:** [February 20, 2019, 3:17pm UTC](https://discuss.elastic.co/t/conditionals-in-filter-clause/169238/1 "2019-02-20T15:17:51Z")

</div>

Hi Im trying to do some conditional processing in the filter section in logstash. The logic is if some field exist do something else other.

```
if [extended_tweet.full_text] {
   nlp {
      source => "extended_tweet.full_text"
   }
}
else if [quoted_status.extended_tweet.full_text] {
   nlp {
      source => "quoted_status.extended_tweet.full_text"
   }
}
else {
   nlp {
      source => "text"
   }
}

```

But all the flow goes on the last else. Is there something wrong in this?

---

<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:** [February 20, 2019, 3:33pm UTC](https://discuss.elastic.co/t/conditionals-in-filter-clause/169238/2 "2019-02-20T15:33:08Z")

</div>

> [@humartinez](#):
>
> if [extended\_tweet.full\_text] {

Do you mean [extended\_tweet][full\_text]?

---

<div class="post-metadata">

**Author:** ![humartinez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/humartinez/32/46395_2.png) [@humartinez](https://discuss.elastic.co/u/humartinez)\
**Post date:** [February 20, 2019, 3:38pm UTC](https://discuss.elastic.co/t/conditionals-in-filter-clause/169238/3 "2019-02-20T15:38:32Z")

</div>

The field in kibana looks like this 'extended\_tweet.full\_text' and the type is string should I search it as you post?

---

<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:** [February 20, 2019, 3:56pm UTC](https://discuss.elastic.co/t/conditionals-in-filter-clause/169238/4 "2019-02-20T15:56:54Z")

</div>

If the field name is extended\_tweet.full\_text, with a dot in the name of the field, then what you have would work. If extended\_tweet is an object that contains a full\_text field then what I wrote would work. If I recall correctly, both would appear as extended\_tweet.full\_text in kibana.

---

<div class="post-metadata">

**Author:** ![humartinez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/humartinez/32/46395_2.png) [@humartinez](https://discuss.elastic.co/u/humartinez)\
**Post date:** [February 20, 2019, 5:37pm UTC](https://discuss.elastic.co/t/conditionals-in-filter-clause/169238/5 "2019-02-20T17:37:25Z")

</div>

For what im seeing now I guess is an object

```
      "extended_tweet" : {
        "properties" : {
          "display_text_range" : {
            "type" : "long"
          },
          "entities" : {
            "properties" : {
              "hashtags" : {
                "properties" : {
                  "indices" : {
                    "type" : "long"
                  },
                  "text" : {
                    "type" : "keyword"
                  }
                }
              },
              "media" : {
                "properties" : {
                  "additional_media_info" : {
                    "properties" : {
                      "monetizable" : {
                        "type" : "boolean"
                      }
                    }
                  },
                  "display_url" : {
                    "type" : "keyword"
                  },
                  "expanded_url" : {
                    "type" : "keyword"
                  },
                  "id" : {
                    "type" : "long"
                  },
                  "id_str" : {
                    "type" : "keyword"
                  },
                  "indices" : {
                    "type" : "long"
                  },
                  "media_url" : {
                    "type" : "keyword"
                  },
                  "media_url_https" : {
                    "type" : "keyword"
                  },
                  "sizes" : {
                    "properties" : {
                      "large" : {
                        "properties" : {
                          "h" : {
                            "type" : "long"
                          },
                          "resize" : {
                            "type" : "keyword"
                          },
                          "w" : {
                            "type" : "long"
                          }
                        }
                      },
                      "medium" : {
                        "properties" : {
                          "h" : {
                            "type" : "long"
                          },
                          "resize" : {
                            "type" : "keyword"
                          },
                          "w" : {
                            "type" : "long"
                          }
                        }
                      },
                      "small" : {
                        "properties" : {
                          "h" : {
                            "type" : "long"
                          },
                          "resize" : {
                            "type" : "keyword"
                          },
                          "w" : {
                            "type" : "long"
                          }
                        }
                      },
                      "thumb" : {
                        "properties" : {
                          "h" : {
                            "type" : "long"
                          },
                          "resize" : {
                            "type" : "keyword"
                          },
                          "w" : {
                            "type" : "long"
                          }
                        }
                      }
                    }
                  },
                  "source_status_id" : {
                    "type" : "long"
                  },
                  "source_status_id_str" : {
                    "type" : "keyword"
                  },
                  "source_user_id" : {
                    "type" : "long"
                  },
                  "source_user_id_str" : {
                    "type" : "keyword"
                  },
                  "type" : {
                    "type" : "keyword"
                  },
                  "url" : {
                    "type" : "keyword"
                  },
                  "video_info" : {
                    "properties" : {
                      "aspect_ratio" : {
                        "type" : "long"
                      },
                      "duration_millis" : {
                        "type" : "long"
                      },
                      "variants" : {
                        "properties" : {
                          "bitrate" : {
                            "type" : "long"
                          },
                          "content_type" : {
                            "type" : "keyword"
                          },
                          "url" : {
                            "type" : "keyword"
                          }
                        }
                      }
                    }
                  }
                }
              },
              "urls" : {
                "properties" : {
                  "display_url" : {
                    "type" : "keyword"
                  },
                  "expanded_url" : {
                    "type" : "keyword"
                  },
                  "indices" : {
                    "type" : "long"
                  },
                  "url" : {
                    "type" : "keyword"
                  }
                }
              },
              "user_mentions" : {
                "properties" : {
                  "id" : {
                    "type" : "long"
                  },
                  "id_str" : {
                    "type" : "keyword"
                  },
                  "indices" : {
                    "type" : "long"
                  },
                  "name" : {
                    "type" : "keyword"
                  },
                  "screen_name" : {
                    "type" : "keyword"
                  }
                }
              }
            }
          },

```

![twitter](https://us1.discourse-cdn.com/elastic/original/3X/d/f/dfd42f2a7a9a8b17c7d4ede0c7febea03bd97c2c.png)

---

<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:** [March 20, 2019, 5:37pm UTC](https://discuss.elastic.co/t/conditionals-in-filter-clause/169238/6 "2019-03-20T17:37:27Z")

</div>

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