Optional fields in custom index template

Hi, Im consuming events from logstash to elastic, I have created an index template for it, Every document will have ONE of this three fields, so if a document has "uptime_seconds" the other fields will be empty, So I was wandering if I there is a way to specify in the template that those fields wil be optional?

      "uptime_seconds": {
        "type": "long"
      }
      "memory_pct": {
        "type": "long"
      }
      "cpu_pct": {
        "type": "long"
      }

You do not need to. The mapping specified how to index fields, not whether they need to be present or not.

2 Likes

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