title: How to add analyzer settings in ElasticSearch?
body: <p>I am using ElasticSearch 1.5.2 and I wish to have the following settings :</p>
  
  <pre><code>"settings": {
  "analysis": {
      "filter": {
          "filter_shingle": {
              "type": "shingle",
              "max_shingle_size": 2,
              "min_shingle_size": 2,
              "output_unigrams": false
          },
          "filter_stemmer": {
              "type": "porter_stem",
              "language": "English"
          }
      },
      "tokenizer": {
          "my_ngram_tokenizer": {
              "type": "nGram",
              "min_gram": 1,
              "max_gram": 1
          }
      },
      "analyzer": {
          "ShingleAnalyzer": {
              "tokenizer": "my_ngram_tokenizer",
              "filter": [
                  "standard",
                  "lowercase",
                  "filter_stemmer",
                  "filter_shingle"
              ]
          }
      }
    }
  }    
  </code></pre>
  
  <p>Where should I add them? I mean before index creation or after?</p>
  
  <p>By searching online I found some method like </p>
  
  <pre><code>client.admin().indices().prepareCreate("temp_index").setSettings(ImmutableSettings.settingsBuilder().loadFromSource((jsonBuilder()
      .startObject()
         .startObject("analysis")
            .startObject("analyzer")......and so on)
  </code></pre>
  
  <p>But I am having 2 issues,</p>
  
  <ol>
  <li><p>I get a compile error : The method loadFromSource in the type ImmutableSettings.builder is not applicable for the arguments XContentBuilder</p></li>
  <li><p>Also, I don't know how to convert my settings to this format. And where is the documentation to get to know about all these methods?
  I tried reading the official ElasticSearch JAVA API <a href="https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/search.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/search.html</a> but I was unable to find anything about setting up analyzers.
  All the related content I find is only in the form of REST APIs and not in Java API.</p></li>
  </ol>