<p dir="auto">Attached are 3 test cases (<a href="https://gist.github.com/ppf2/3ce59f1f1332bb41af46">https://gist.github.com/ppf2/3ce59f1f1332bb41af46</a>):</p>
<h1 dir="auto">TEST 1 (Dynamically mapped fields):  Create an index at index creation time.  Then add data.  You will see that the alias does not work.</h1>
<h1 dir="auto">TEST 2 (Dynamically mapped fields):  Create an index with no alias defined.  Add data, then create the alias afterwards. You will see that the alias works this time.</h1>
<h1 dir="auto">TEST 3 (Explicitly mapped fields):  Create an index at index creation time.  But this time, define an explicit mapping for the fields as well. Then add data.  You will see that the alias works this time.</h1>
<p dir="auto">If this is the expected behavior, can we include a disclaimer in the documentation (and ideally, catch this condition and throw and error to prevent the index alias from being created in the first place?)</p>
<p dir="auto">Today, if we create a filtered alias or a percolator query which references a field that is not yet mapped, the field is interpreted as a string.</p>
<p dir="auto">This is a problem when (eg) the user then indexes a document where the field is really numeric or a date.  Any existing filters or percolator queries will not work correctly until the cached filter/query is regenerated (eg after a restart).</p>
<p dir="auto">Instead, we should support a "strict" query parsing mode which throws an error if an unmapped field is referenced.</p>