title: Surrounding multiple words with tags - ElasticSearch Highlighter in Java
body: <p>When performing ElasticSearchs query with highlighting, is it possible to surround more than one word with highlighting tags?</p>
  
  <p>For example when I perform query "ajax basics", I get:</p>
  
  <pre><code>someText... &lt;a href='#' class='highlightedTerm'&gt;ajax&lt;/a&gt; &lt;a href='#' class='highlightedField'&gt;basics&lt;/a&gt; someText...
  </code></pre>
  
  <p>And this is what I would like to get:</p>
  
  <pre><code>someText... &lt;a href='#' class='highlightedTerm'&gt;ajax basics&lt;/a&gt; someText...
  </code></pre>
  
  <p>I am using these settings for highlighter and querying:</p>
  
  <pre><code>SearchResponse response = getClient().prepareSearch("user")
      .setTypes("document")
      .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
      .setPostFilter(privacyFilter)
      .setQuery(qb)
      .setFrom(first)
      .setSize(pageSize)
      .setExplain(true)
      //
      // Highlight
      .addHighlightedField("fileName")
      .addHighlightedField("content")
      .setHighlighterOptions(highlighterOptions)
      .setHighlighterPreTags("&lt;a href='#' class='highlightedTerm'&gt;")
      .setHighlighterPostTags("&lt;/a&gt;")
      // -------------------------------------
      //
      .addFields("*", "_source")
      .execute()
      .actionGet();
  </code></pre>
  
  <p>I have tried to remove <em>space</em> from boundary characters:</p>
  
  <pre><code>Map&lt;String, Object&gt; highlighterOptions = new HashMap&lt;&gt;();
  highlighterOptions.put("boundary_chars", "s.,!?\\t\\n");
  </code></pre>
  
  <p>But, the result was the same.</p>
  
  <p>Thanks</p>
  
  <p>Vladimir</p>