title: Elastic search: Highlight wildcrad search result
body: <p>I use elastic search 7.10 and like to find documents by wildcard search on analyzed fields and highlight those in text. But this doesn't work.</p>
  <p>The document could contain the following example: <code>&quot;The color of the car is black.&quot;</code>
  I expect a result in which <code>car</code> and <code>black</code> is marked.</p>
  <p>I have the following mapping:</p>
  <pre><code> &quot;text&quot;: {
              &quot;type&quot;: &quot;text&quot;,
              &quot;store&quot;: true,
              &quot;term_vector&quot;: &quot;with_positions_offsets&quot;,
              &quot;analyzer&quot;: &quot;my_analyzer&quot;,
              &quot;fields&quot;: {
                  &quot;keyword&quot;: {
                      &quot;type&quot;: &quot;keyword&quot;,
                      &quot;ignore_above&quot;: 8000
                  },
                  &quot;wc&quot; :{
                      &quot;type&quot;: &quot;wildcard&quot;
                  }
              }
          },
  </code></pre>
  <p>I use the following query:</p>
  <pre><code>{
      &quot;query&quot;: {
          &quot;bool&quot;: {
              &quot;should&quot;: [ 
                  {
                     &quot;match&quot;: {&quot;text&quot;: &quot;car&quot;}
                  },
                  {
                     &quot;wildcard&quot;: { &quot;text.wc&quot;: { &quot;value&quot;: &quot;bl*&quot; } }
                  }
              ]
          }
      },
      &quot;fields&quot;: [&quot;text&quot;, &quot;text.wc&quot;],
      &quot;highlight&quot;: {
          &quot;pre_tags&quot;: [
              &quot;&lt;span class='marker'&gt;&quot;
          ],
          &quot;post_tags&quot;: [
              &quot;&lt;/span&gt;&quot;
          ],
          &quot;type&quot;: &quot;fvh&quot;,
          &quot;fields&quot;: {
              &quot;*&quot;: {
                  &quot;pre_tags&quot;: [
                      &quot;&lt;em&gt;&quot;
                  ],
                  &quot;post_tags&quot;: [
                      &quot;&lt;/em&gt;&quot;
                  ]
              }
          },
          &quot;require_field_match&quot;: true
      }
  }
  </code></pre>
  <p>The query resultsets only contains highlight for the <code>text</code> - field, but not for the <code>text.wc</code> field. I also tried an separate wildcard-field, which is not an subfield of <code>text</code> but this also does not work. I also notice, that <code>_source</code>- field set to <code>enabled</code> is needed, even if all the fields are set to store otherwise I get an <code>Unable to retrieve the requested [fields]</code> message.</p>
  <p>Question: How can I get highlighted text for a wildcrad searchterm?</p>