【问题标题】:ElasticSearch Ingest Pipeline Null Value QuestionElasticSearch Ingest Pipeline Null Value Question
【发布时间】:2022-12-27 22:38:32
【问题描述】:

If I am using an elasticsearch ingest pipeline in a Filebeat module, and I see the statement of: if: 'ctx.json?.userIdentity?.userName == null'

When json.userIdentity.userName is equal to null, what would the key/value pair look like when the if statement above would be true? {"json.userIdentity.userName":"null"}, {"json.userIdentity.userName":null}, or something else

In addition, is it fair to say that if the field doesnt exist, then the key is also equal to null?

This has been answered and is closed

【问题讨论】:

    标签: elasticsearch elastic-stack filebeat elastic-beats


    【解决方案1】:

    It means that the pipeline processor will execute in any of the following conditions:

    // no json key
    {}
    
    // null json key
    {
       "json": null
    }
    
    // empty json key
    {
       "json": {}
    }
    
    // null json.userIdentity key
    {
       "json": {
          "userIdentity": null
       }
    }
    
    // empty json.userIdentity key
    {
       "json": {
          "userIdentity": {}
       }
    }
    
    // null json.userIdentity.userName key
    {
       "json": {
          "userIdentity": {
             "userName": null
          }
       }
    }
    

    【讨论】:

    • If the root value json were not null, and not blank, then the check would be to determine if the value were equal to null, blank, or a subkey were null. Is that understanding correct?
    • Basically, the condition will be true in any situation where userName doesn't have a value, doesn't exist
    • Thank you very much! It is greatly appreciated! That makes sense
    • Awesome, glad it helped!
    猜你喜欢
    • 2019-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-24
    • 2018-04-09
    相关资源
    最近更新 更多