title: Basics of adding a custom analyzer to an index built using spring
body: <p>I think this is a very basic question but I keep going around the houses so any help pointing me in the right direction would be appreciated.</p>
  
  <p>I have inherited a java application which builds and elastic search index using spring-data-elasticsearch (1.2.1.RELEASE at the moment).  I have modified this quite successfully in various trivial ways but now I want to add a custom analyzer to use on one field (char mapping to remove /'s).</p>
  
  <p>The index being built is essentially 1 index with various document types.  It seems to be built pretty much out of the box.  I'm fairly new to java and spring but and tracking down all the config and auto-wiring can still outfox me sometimes but as far as I can see the client config in the context XML file points directly to the spring code and doesn't add much except the custom index name and a location for the repository interfaces and code </p>
  
  <pre><code>&lt;elasticsearch:node-client id="esClient" local="true" cluster-name="products"/&gt;
  &lt;elasticsearch:repositories base-package="com.warehouse.es.repos"/&gt;
  
  &lt;bean name="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate"&gt;
      &lt;constructor-arg name="client" ref="esClient"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>The code then seems to use an out of the box client object </p>
  
  <pre><code>@Autowired
  public void setClient(Client client) throws IOException {
      this.client = client;
  </code></pre>
  
  <p>and then goes on to set various typemappings using mapping files along these lines</p>
  
  <pre><code>createTypeMapping(client, Constants.INDEX_NAME, INDEX_TYPE, "Products.mapping");
  </code></pre>
  
  <p>Apologies if some of this is either too brief (or too much waffle for this basic question) but I'm trying to work out / find an example of how and where to add my custom analyzer.  I have documentation and examples to show me how to create some json to create the custom analyzer
  (e.g. <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-mapping-charfilter.html#analysis-mapping-charfilter" rel="nofollow">https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-mapping-charfilter.html#analysis-mapping-charfilter</a>
  and some previous stackoverflow q&amp;s's)</p>
  
  <p>but I'm struggling to understand where I add this in my java code creating the index.  </p>
  
  <p>Obviously the more help the better (!) but really at this stage I'm trying to get a grip of whether I could just add the analyzer to the yml file or whether I need to add some code to modify the client in some way ?  or possibly even just add it to the individual type mappings.</p>
  
  <p>Thanks.</p>