Creates new index.

@param name the name of the index to test.
@param type index type
@param mappings field mapping definition.
@return true if index was created.
@throws IOException communication exception.
487319
public boolean createIndex(String name, String type, EsRequest mappings) throws IOException {
        if (indexExists(name)) {
            return true;
        }

        CloseableHttpClient client = HttpClients.createDefault();
        HttpPost method = new HttpPost(String.format("http://%s:%d/%s", host, port, name));
        try {
            StringEntity requestEntity = new StringEntity(mappings.toString(), ContentType.APPLICATION_JSON);
            method.setEntity(requestEntity);
            CloseableHttpResponse resp = client.execute(method);
            return resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK;
        } finally {
            method.releaseConnection();
        }
    }
249679
@SuppressWarnings("unchecked")
    protected <K, V, E extends SimpleExpression<? super V>> MapPath<K, V, E> createMap(String property, Class<? super K> key, Class<? super V> value, Class<? super E> queryType) {
        return add(new MapPath<K, V, E>(key, value, (Class) queryType, forProperty(property)));
    }
86080
public static void addNewMapping(final Class<?> type, final String property, final String mapping) {
        allowedColmns.computeIfAbsent(type, k -> new HashMap<>());
        allowedColmns.get(type).put(property, mapping);
    }
252098
public static void setJdbcType(String typeName, int typeIndex, JdbcType type)
    {
        setJdbcTypeByName(typeName, type);
        setJdbcTypeByTypesIndex(typeIndex, type);
    }
428766
public <S, D> TypeMap<S, D> create(S source, Class<S> sourceType, Class<D> destinationType,
      String typeMapName, InheritingConfiguration configuration, MappingEngineImpl engine) {
    synchronized (lock) {
      TypeMapImpl<S, D> typeMap = new TypeMapImpl<S, D>(sourceType, destinationType, typeMapName,
          configuration, engine);
      if (configuration.isImplicitMappingEnabled()
          && Types.mightContainsProperties(typeMap.getSourceType())
          && Types.mightContainsProperties(typeMap.getDestinationType()))
        ImplicitMappingBuilder.build(source, typeMap, config.typeMapStore, config.converterStore);
      typeMaps.put(TypePair.of(sourceType, destinationType, typeMapName), typeMap);
      return typeMap;
    }
  }
390943
public void addMapping(Mapping mapping)
    {
        if (mapping != null)
        {
            mappings.put(mapping.getType(), mapping);
        }
    }
441212
@SuppressWarnings("unchecked")
	public static <K, V> Map<K, V> createMap(Class<?> mapType) {
		if (mapType.isAssignableFrom(AbstractMap.class)) {
			return new HashMap<>();
		} else {
			return (Map<K, V>) ReflectUtil.newInstance(mapType);
		}
	}
582109
def _create_percolator_mapping(index, doc_type):
    
    if ES_VERSION[0] >= 5:
        current_search_client.indices.put_mapping(
            index=index, doc_type=doc_type,
            body=PERCOLATOR_MAPPING, ignore=[400, 404])
695664
private void initMappings() throws Exception {
        checkClient();
        // We extract indexes and mappings to manage from mappings definition
        if (mappings != null && mappings.length > 0) {
            Map<String, Collection<String>> indices = getIndexMappings(mappings);

            // Let's initialize indexes and mappings if needed
            for (String index : indices.keySet()) {
                createIndex(client.getLowLevelClient(), classpathRoot, index, forceMapping);
                if (mergeSettings) {
                    updateSettings(client.getLowLevelClient(), classpathRoot, index);
                }

                createMapping(client, classpathRoot, index, mergeMapping);
            }
        }
    }
1361678
private Mapper createMapper(Type type) {
    lock.lock();
    try {
      Mapper mapper = cache.get(type);
      if (mapper != null) {
        return mapper;
      }
      if (type instanceof Class) {
        mapper = createMapper((Class<?>) type);
      } else if (type instanceof ParameterizedType) {
        mapper = createMapper((ParameterizedType) type);
      } else {
        throw new IllegalArgumentException(
            String.format("Type %s is neither a Class nor ParameterizedType", type));
      }
      cache.put(type, mapper);
      return mapper;
    } finally {
      lock.unlock();
    }
  }
783980
public void deleteByQuery(String index, String type) throws IOException {
        logger.debug("deleteByQuery [{}]/[{}]", index, type);

        String deleteByQuery = "{\n" +
                "  \"query\": {\n" +
                "    \"match_all\": {}\n" +
                "  }\n" +
                "}";

        Request request = new Request("POST", "/" + index + "/" + type + "/_delete_by_query");
        request.setJsonEntity(deleteByQuery);
        Response restResponse = client.getLowLevelClient().performRequest(request);
        Map<String, Object> response = asMap(restResponse);
        logger.debug("reindex response: {}", response);
    }
668051
@Override
    public <T> Query<T> createNamedQuery(Class<T> entityType, String queryName) {
        return ebeanServer.createNamedQuery(entityType, queryName);
    }
664861
public boolean existIndiceType(String indiceName,String type) throws ElasticSearchException{
		try {
			executeHttp(new StringBuilder(indiceName).append("/_mapping/").append(type).toString(), ClientInterface.HTTP_HEAD);
			return true;
		}
		catch(ElasticSearchException e){
			return ResultUtil.hand404HttpRuntimeException(e,boolean.class,ResultUtil.OPERTYPE_existIndiceType);
		}
	}
197164
public <S, D> TypeMap<S, D> getOrCreate(S source, Class<S> sourceType, Class<D> destinationType,
      String typeMapName, MappingEngineImpl engine) {
    return getOrCreate(source, sourceType, destinationType, typeMapName, null, null,
        engine);
  }
385840
private void indexEntity(String type, String id, XContentBuilder sourceEntity) throws StorageException {
        indexEntity(type, id, sourceEntity, false);
    }
488792
@Override
    protected <T> T create(Class<T> type, Map<String, String> mapConfig) {
        try {
            Constructor<T> constructor = type.getConstructor(Vertx.class, VertxEngineConfig.class, Map.class);
            return constructor.newInstance(vertx, engineConfig, mapConfig);
        } catch (Exception e) {
        }
        try {
            Constructor<T> constructor = type.getConstructor(Map.class);
            return constructor.newInstance(mapConfig);
        } catch (Exception e) {
        }
        try {
            return type.newInstance();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
136538
int resolveNameAndTypeIndex(String name, String descriptor)
    {
        int size = 0;
        int index = 0;
        constantReadLock.lock();
        try
        {
            size = getConstantPoolSize();
            index = getNameAndTypeIndex(name, descriptor);
        }
        finally
        {
            constantReadLock.unlock();
        }
        if (index != -1)
        {
            return index;
        }
        else
        {
            int nameIndex = resolveNameIndex(name);
            int typeIndex = resolveNameIndex(descriptor);
            return addConstantInfo(new NameAndType(nameIndex, typeIndex), size);
        }
    }