Tabnine Logo
PutMappingRequestBuilder.setType
Code IndexAdd Tabnine to your IDE (free)

How to use
setType
method
in
org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder

Best Java code snippets using org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder.setType (Showing top 20 results out of 531)

origin: loklak/loklak_server

public void setMapping(String indexName, File json) {
  try {
    this.elasticsearchClient.admin().indices().preparePutMapping(indexName)
      .setSource(new String(Files.readAllBytes(json.toPath()), StandardCharsets.UTF_8))
      .setUpdateAllTypes(true)
      .setType("_default_")
      .execute()
      .actionGet();
  } catch (Throwable e) {
    DAO.severe(e);
  };
}
origin: apache/usergrid

/**
 * Setup ElasticSearch type mappings as a template that applies to all new indexes.
 * Applies to all indexes that* start with our prefix.
 */
private void createMappings(final String indexName)  {
  //Added For Graphite Metrics
  PutMappingResponse pitr = provider.getClient().admin().indices().preparePutMapping( indexName ).setType( "entity" ).setSource(
    getMappingsContent() ).execute().actionGet();
  if ( !pitr.isAcknowledged() ) {
    throw new RuntimeException( "Unable to create default mappings" );
  }
}
origin: Netflix/conductor

private void addMappingToIndex(String indexName, String mappingType, String mappingFilename)
  throws IOException {
  GetMappingsResponse getMappingsResponse = elasticSearchClient.admin()
    .indices()
    .prepareGetMappings(indexName)
    .addTypes(mappingType)
    .execute()
    .actionGet();
  if (getMappingsResponse.mappings().isEmpty()) {
    logger.info("Adding the workflow type mappings");
    InputStream stream = ElasticSearchDAOV5.class.getResourceAsStream(mappingFilename);
    byte[] bytes = IOUtils.toByteArray(stream);
    String source = new String(bytes);
    try {
      elasticSearchClient.admin()
        .indices()
        .preparePutMapping(indexName)
        .setType(mappingType)
        .setSource(source)
        .execute()
        .actionGet();
    } catch (Exception e) {
      logger.error("Failed to init index mappings", e);
    }
  }
}
origin: apache/usergrid

/**
 * Setup ElasticSearch type mappings as a template that applies to all new indexes.
 * Applies to all indexes that* start with our prefix.
 */
private void createMappings(final String indexName) throws IOException {
  //Added For Graphite Metrics
  Timer.Context timePutIndex = mappingTimer.time();
  PutMappingResponse  pitr = esProvider.getClient().admin().indices().preparePutMapping( indexName ).setType( "entity" ).setSource(
    getMappingsContent() ).execute().actionGet();
  timePutIndex.stop();
  if ( !pitr.isAcknowledged() ) {
    throw new IndexException( "Unable to create default mappings" );
  }
}
origin: thinkaurelius/titan

      setIgnoreConflicts(false).setType(store).setSource(mapping).execute().actionGet();
} catch (Exception e) {
  throw convert(e);
origin: SonarSource/sonarqube

@Test
public void to_string() {
 assertThat(es.client().preparePutMapping(FakeIndexDefinition.INDEX).setSource(mapDomain()).toString())
  .isEqualTo("ES put mapping request on indices 'fakes' with source '{\"dynamic\":false,\"_all\":{\"enabled\":false}}'");
 assertThat(es.client().preparePutMapping(FakeIndexDefinition.INDEX).setType(FakeIndexDefinition.TYPE).setSource(mapDomain()).toString())
  .isEqualTo("ES put mapping request on indices 'fakes' on type 'fake' with source '{\"dynamic\":false,\"_all\":{\"enabled\":false}}'");
}
origin: SonarSource/sonarqube

LOGGER.info(String.format("Create type %s/%s", index.getName(), entry.getKey()));
PutMappingResponse mappingResponse = client.preparePutMapping(index.getName())
 .setType(entry.getKey())
 .setSource(entry.getValue().getAttributes())
 .get();
origin: SonarSource/sonarqube

@Test
public void trace_logs() {
 logTester.setLevel(LoggerLevel.TRACE);
 PutMappingRequestBuilder requestBuilder = es.client().preparePutMapping(FakeIndexDefinition.INDEX)
  .setType(FakeIndexDefinition.TYPE)
  .setSource(mapDomain());
 requestBuilder.get();
 assertThat(logTester.logs(LoggerLevel.TRACE)).hasSize(1);
}
origin: richardwilly98/elasticsearch-river-mongodb

PutMappingResponse pmr = client.admin().indices().preparePutMapping(index).setType(type)
    .setSource(mapping.getSourceAsMap()).get();
if (!pmr.isAcknowledged()) {
origin: SonarSource/sonarqube

@Test
public void put_mapping() {
 PutMappingRequestBuilder requestBuilder = es.client().preparePutMapping(FakeIndexDefinition.INDEX)
  .setType(FakeIndexDefinition.TYPE)
  .setSource(mapDomain());
 requestBuilder.get();
}
origin: SonarSource/sonarqube

.setType(entry.getKey())
.setSource(entry.getValue().getAttributes())
.get();
origin: yacy/yacy_grid_mcp

public void setMapping(String indexName, File json) {
  try {
    this.elasticsearchClient.admin().indices().preparePutMapping(indexName)
      .setSource(new String(Files.readAllBytes(json.toPath()), StandardCharsets.UTF_8), XContentType.JSON)
      .setUpdateAllTypes(true)
      .setType("_default_")
      .execute()
      .actionGet();
  } catch (Throwable e) {
    Data.logger.warn("", e);
  };
}
origin: richardwilly98/elasticsearch-river-mongodb

    logger.debug("Set explicit attachment mapping.");
  esClient.admin().indices().preparePutMapping(definition.getIndexName()).setType(definition.getTypeName())
      .setSource(getGridFSMapping()).get();
} catch (Exception e) {
origin: yacy/yacy_grid_mcp

public void setMapping(String indexName, Map<String, Object> mapping) {
  try {
    this.elasticsearchClient.admin().indices().preparePutMapping(indexName)
      .setSource(mapping)
      .setUpdateAllTypes(true)
      .setType("_default_").execute().actionGet();
  } catch (Throwable e) {
    Data.logger.warn("", e);
  };
}
origin: yacy/yacy_grid_mcp

public void setMapping(String indexName, String mapping) {
  try {
    this.elasticsearchClient.admin().indices().preparePutMapping(indexName)
      .setSource(mapping, XContentType.JSON)
      .setUpdateAllTypes(true)
      .setType("_default_").execute().actionGet();
  } catch (Throwable e) {
    Data.logger.warn("", e);
  };
}
origin: yacy/yacy_grid_mcp

public void setMapping(String indexName, XContentBuilder mapping) {
  try {
    this.elasticsearchClient.admin().indices().preparePutMapping(indexName)
      .setSource(mapping)
      .setUpdateAllTypes(true)
      .setType("_default_").execute().actionGet();
  } catch (Throwable e) {
    Data.logger.warn("", e);
  };
}
origin: komoot/photon

public void recreateIndex() throws IOException {
  deleteIndex();
  final Client client = this.getClient();
  final InputStream mappings = Thread.currentThread().getContextClassLoader()
      .getResourceAsStream("mappings.json");
  final InputStream index_settings = Thread.currentThread().getContextClassLoader()
      .getResourceAsStream("index_settings.json");
  String mappingsString = IOUtils.toString(mappings);
  JSONObject mappingsJSON = new JSONObject(mappingsString);
  // add all langs to the mapping
  mappingsJSON = addLangsToMapping(mappingsJSON);
  client.admin().indices().prepareCreate("photon").setSettings(IOUtils.toString(index_settings)).execute()
      .actionGet();
  client.admin().indices().preparePutMapping("photon").setType("place").setSource(mappingsJSON.toString())
      .execute().actionGet();
  log.info("mapping created: " + mappingsJSON.toString());
}
origin: org.elasticsearch/elasticsearch

private PutMappingRequestBuilder updateMappingRequest(Index index, String type, Mapping mappingUpdate, final TimeValue timeout) {
  if (type.equals(MapperService.DEFAULT_MAPPING)) {
    throw new IllegalArgumentException("_default_ mapping should not be updated");
  }
  return client.preparePutMapping().setConcreteIndex(index).setType(type).setSource(mappingUpdate.toString(), XContentType.JSON)
      .setMasterNodeTimeout(timeout).setTimeout(timeout);
}
origin: org.elasticsearch/elasticsearch

@Override
public IndexShard createShard(ShardRouting shardRouting, RecoveryState recoveryState, PeerRecoveryTargetService recoveryTargetService,
               PeerRecoveryTargetService.RecoveryListener recoveryListener, RepositoriesService repositoriesService,
               Consumer<IndexShard.ShardFailure> onShardFailure,
               Consumer<ShardId> globalCheckpointSyncer) throws IOException {
  ensureChangesAllowed();
  IndexService indexService = indexService(shardRouting.index());
  IndexShard indexShard = indexService.createShard(shardRouting, globalCheckpointSyncer);
  indexShard.addShardFailureCallback(onShardFailure);
  indexShard.startRecovery(recoveryState, recoveryTargetService, recoveryListener, repositoriesService,
    (type, mapping) -> {
      assert recoveryState.getRecoverySource().getType() == RecoverySource.Type.LOCAL_SHARDS:
        "mapping update consumer only required by local shards recovery";
      client.admin().indices().preparePutMapping()
        .setConcreteIndex(shardRouting.index()) // concrete index - no name clash, it uses uuid
        .setType(type)
        .setSource(mapping.source().string(), XContentType.JSON)
        .get();
    }, this);
  return indexShard;
}
origin: org.elasticsearch/elasticsearch

if (getTaskResultMappingVersion(metaData) < TASK_RESULT_MAPPING_VERSION) {
  client.admin().indices().preparePutMapping(TASK_INDEX).setType(TASK_TYPE)
    .setSource(taskResultIndexMapping(), XContentType.JSON)
    .execute(new ActionListener<AcknowledgedResponse>() {
org.elasticsearch.action.admin.indices.mapping.putPutMappingRequestBuildersetType

Javadoc

The type of the mappings.

Popular methods of PutMappingRequestBuilder

  • setSource
    A specialized simplified mapping source method, takes the form of simple properties definition: ("fi
  • execute
  • get
  • setIgnoreConflicts
  • setIndices
  • <init>
  • setMasterNodeTimeout
  • setTimeout
  • setConcreteIndex
  • setUpdateAllTypes
    True if all fields that span multiple types should be updated, false otherwise

Popular in Java

  • Updating database using SQL prepared statement
  • setContentView (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged (ArrayAdapter)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Permission (java.security)
    Legacy security code; do not use.
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • JTextField (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now