fluid-api/src/main/java/com/fluidbpm/program/api/util/elasticsearch/ESFormFieldMappingUtil.java
public GetIndexResponse getOrCreateIndex(String indexParam) {
		if(this.doesIndexExist(indexParam)) {
			return this.client.admin().indices().prepareGetIndex().get();
		} else {
			CreateIndexRequestBuilder createIndexRequestBuilder =
					this.client.admin().indices().prepareCreate(indexParam);

			CreateIndexResponse mappingCreateResponse =
					createIndexRequestBuilder.execute().actionGet();

			if(!mappingCreateResponse.isAcknowledged()) {
				throw new FluidElasticSearchException(
						"Index Creation for '"+
								indexParam+"' not acknowledged by ElasticSearch.");
			}

			return this.client.admin().indices().prepareGetIndex().get();
		}
	}
public GetIndexResponse getOrCreateIndex(String indexParam) {
		if(this.doesIndexExist(indexParam)) {
			return this.client.admin().indices().prepareGetIndex().get();
		} else {
			CreateIndexRequestBuilder createIndexRequestBuilder =
					this.client.admin().indices().prepareCreate(indexParam);

			CreateIndexResponse mappingCreateResponse =
					createIndexRequestBuilder.execute().actionGet();

			if(!mappingCreateResponse.isAcknowledged()) {
				throw new FluidElasticSearchException(
						"Index Creation for '"+
								indexParam+"' not acknowledged by ElasticSearch.");
			}

			return this.client.admin().indices().prepareGetIndex().get();
		}
	}
public GetIndexResponse getOrCreateIndex ( String indexParam ) { if ( this . doesIndexExist ( indexParam ) ) { return this . client . admin ( ) . indices ( ) . prepareGetIndex ( ) . get ( ) ; } else { CreateIndexRequestBuilder createIndexRequestBuilder = this . client . admin ( ) . indices ( ) . prepareCreate ( indexParam ) ; CreateIndexResponse mappingCreateResponse = createIndexRequestBuilder . execute ( ) . actionGet ( ) ; if ( ! mappingCreateResponse . isAcknowledged ( ) ) { throw new FluidElasticSearchException ( "Index Creation for '" + indexParam + "' not acknowledged by ElasticSearch." ) ; } return this . client . admin ( ) . indices ( ) . prepareGetIndex ( ) . get ( ) ; } }
Creates a new index or fetches existing index.

@param indexParam The name of the index to create in lower-case.
@return Newly created or existing index.

@see GetIndexResponse
Creates a new index or fetches existing index .