title: Is there a way to give ElasticSearch "default/override" values?
body: <p>I have a hypothetical ElasticSearch index containing information about users configuration on various systems. All the systems use the same fields/values for their configuration, a user has a set of default config options that will be used if no custom options are set for a system, and to reduce space I want to avoid repeating the default values.</p>
  
  <p>Consider this example ElasticSearch document source object:</p>
  
  <pre><code>{
    userId: 12345,
    default: {
      columnWidth: 250,
      rowHeight: 100,
      pageSize: 50,
      autoRefreshInterval: 60
    },
    systems: {
      systemA: {
        autoRefreshInterval: 0,
        pageSize: 500
      },
      systemB: {
        columnWidth: 400
      }
    }
  }
  </code></pre>
  
  <p>Fetching this document by userID is easy enough, but what if I want to do some queries about how the users use the systems? If I wanted to find all users that don't use auto-refresh for systemB I would have to query <code>systems.systemB.autoRefreshInterval:0 OR (_missing_:systems.systemB.autoRefreshInterval AND default.autoRefreshInterval:0)</code> which is verbose and would be a nightmare to query more than one attribute at a time. Is there any way to configure the index mapping to set default or fallback fields that will allow me to simply query <code>systems.systemB.autoRefreshInterval:0</code> and get this document back because the default value is set correctly?</p>