Binh_Ly_2  
                (Binh Ly-2)
               
              
                  
                    March 13, 2014,  8:08pm
                   
                   
              4 
               
             
            
              prepareIndex() is to index a document. What you want is prepareCreate(). I 
have an example here (check the method createIndexFullMapping()):
  
  
    
package admin;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
public class IndexAdminExample {
    public static void createIndex (Client client) {
        String index = "test";
        //delete index if exists
        if (client.admin().indices().prepareExists(index).execute().actionGet().isExists())
            client.admin().indices().prepareDelete(index).execute().actionGet();
        
        Settings settings = ImmutableSettings.settingsBuilder()
            .put("number_of_shards", 1)
            .put("number_of_replicas", 0)
 
  This file has been truncated. show original 
   
  
    
    
  
  
 
-- 
You received this message because you are subscribed to the Google Groups "elasticsearch" group. 
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com . 
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ef4c75f2-4f29-4fc2-92ea-79077df54a9c%40googlegroups.com . 
For more options, visit https://groups.google.com/d/optout .