當前位置: 首頁>>代碼示例>>Java>>正文


Java MapperAttachmentsPlugin類代碼示例

本文整理匯總了Java中org.elasticsearch.mapper.attachments.MapperAttachmentsPlugin的典型用法代碼示例。如果您正苦於以下問題:Java MapperAttachmentsPlugin類的具體用法?Java MapperAttachmentsPlugin怎麽用?Java MapperAttachmentsPlugin使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MapperAttachmentsPlugin類屬於org.elasticsearch.mapper.attachments包,在下文中一共展示了MapperAttachmentsPlugin類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startEmbeddedES

import org.elasticsearch.mapper.attachments.MapperAttachmentsPlugin; //導入依賴的package包/類
/**
 * Start an Elasticsearch instance
 */
private static void startEmbeddedES() {
  if(esPort == null) {
    try {
      esPort = getAvailablePort();
    } catch (IOException e) {
      fail("Cannot get available port : " + e.getMessage());
    }
  }

  // Init ES
  LOGGER.info("Embedded ES instance - Starting on port " + esPort);
  Settings.Builder elasticsearchSettings = Settings.settingsBuilder()
          .put(Node.HTTP_ENABLED, true)
          .put("network.host", "127.0.0.1")
          .put("http.port", esPort)
          .put("name", "esEmbeddedForTests" + esPort)
          .put("path.home", "target/es")
          .put("path.data", "target/es")
          .put("plugins.load_classpath_plugins", true);

  Environment environment = new Environment(elasticsearchSettings.build());
  Collection plugins = new ArrayList<>();
  Collections.<Class<? extends Plugin>>addAll(plugins, MapperAttachmentsPlugin.class, DeleteByQueryPlugin.class);
  node = new EmbeddedNode(environment, Version.CURRENT, plugins);
  node.start();
  //node = nodeBuilder().local(true).settings(elasticsearchSettings.build()).node();
  node.client().admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
  assertNotNull(node);
  assertFalse(node.isClosed());
  LOGGER.info("Embedded ES instance - Started");
  // Set URL of server in property
  NodesInfoRequest nodesInfoRequest = new NodesInfoRequest().transport(true);
  NodesInfoResponse response = node.client().admin().cluster().nodesInfo(nodesInfoRequest).actionGet();
  NodeInfo nodeInfo = response.iterator().next();
  InetSocketTransportAddress address = (InetSocketTransportAddress) nodeInfo.getHttp().getAddress().publishAddress();
  String url = "http://" + address.address().getHostName() + ":" + address.address().getPort();
  PropertyManager.setProperty("exo.es.index.server.url", url);
  PropertyManager.setProperty("exo.es.search.server.url", url);
}
 
開發者ID:exo-archives,項目名稱:exo-es-search,代碼行數:43,代碼來源:BaseIntegrationTest.java

示例2: start

import org.elasticsearch.mapper.attachments.MapperAttachmentsPlugin; //導入依賴的package包/類
public static void start(Map<String, Object> settings, boolean embeddedMode) throws Exception {

        Settings.Builder builder = Settings.settingsBuilder();

        for(String key: settings.keySet()) {
            builder.put(key, String.valueOf(settings.get(key)));
        }
        
        if(embeddedMode) {
            try {
                FileUtils.forceDelete(new File("./data"));
            } catch (Exception e) {
                //ignore
            }
            builder.put("path.home",".");
            builder.put("node.local", true);
            builder.put("http.cors.enabled", true);
            builder.put("http.cors.allow-origin", "*");
            builder.put("cluster.name", "imap-embedded-"+System.currentTimeMillis());
            node = new PluginAwareNode(builder.build(), (Collection) Lists.newArrayList(MapperAttachmentsPlugin.class));
            node.start();
            client = node.client();
        }else
        {
            Settings eSettings = builder.build();
            client = new TransportClient.Builder().settings(eSettings).build();
            String[] hosts = eSettings.get("elasticsearch.hosts").split(",");
            
            for (int i = 0; i < hosts.length; i++) {
                String host = hosts[i];
                String hostOnly = host.split(":")[0];
                String portOnly = host.split(":")[1];
                System.out.println("Adding "+hostOnly+":"+portOnly);
                ((TransportClient)client).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostOnly), Integer.parseInt(portOnly)));
            }
        }
        imap = new IMAPImporter(settings, client);
        imap.start();
    }
 
開發者ID:salyh,項目名稱:elasticsearch-imap,代碼行數:40,代碼來源:IMAPImporterCl.java

示例3: initServer

import org.elasticsearch.mapper.attachments.MapperAttachmentsPlugin; //導入依賴的package包/類
private void initServer(int size, Boolean publishHost, Integer presetSSLPort){
  for (int i = 0; i < size; i++) {

    File data = Files.createTempDir();
    data.deleteOnExit();
    File home = Files.createTempDir();
    home.deleteOnExit();

    String name = NODE_NAME_PREFIX + i;

    Settings.Builder settingsBuilder = Settings.builder()
            .put("node.name", name)
            .put("path.home", home.getAbsolutePath())
            .put("path.data", data.getAbsolutePath())
            .put("cluster.routing.allocation.disk.threshold_enabled", false)
            .put("node.local", true)
            .put("node.data", true)
            .put("cluster.name", CLUSTER_NAME)
            .put("script.inline", scriptsEnabled)
            .put("script.max_compilations_per_minute", 200)
            .put("script.indexed", scriptsEnabled);

    if (publishHost) {
      settingsBuilder
      .put("http.publish_host", "localhost")
      .put("http.publish_port", ELASTICSEARCH_PORT);
    }

    if (sslEnabled) {
      File keystoreFile = new File("target/tests/ssl/" + name + ".jks");
      String password = "dummy";
      genCertificate(keystoreFile, password);

      sslPort = setupSSLProxy(keystoreFile, password, "127.0.0.1", ELASTICSEARCH_PORT, presetSSLPort);

      // we must tell elastic to advertise the proxy instead
      settingsBuilder
        .put("http.publish_host", "localhost")
        .put("http.publish_port", sslPort);
    }

    Settings settings = settingsBuilder.build();
    ArrayList<Class<? extends Plugin>> plugins = new ArrayList<>(2);
    plugins.add(MapperAttachmentsPlugin.class);
    plugins.add(GroovyPlugin.class);
    nodes[i] = new ElasticTestNode(settings, plugins); // nodeBuilder().settings(settings).node();
    logger.info("--> Elasticsearch node [{} (cluster: {}, home: {}, data: {}] started", name, CLUSTER_NAME,
            home.getAbsolutePath(), data.getAbsolutePath());
  }

}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:52,代碼來源:ElasticsearchCluster.java

示例4: setUp

import org.elasticsearch.mapper.attachments.MapperAttachmentsPlugin; //導入依賴的package包/類
@Before
public void setUp() throws Exception {

    System.out.println("--------------------- SETUP " + name.getMethodName() + " -------------------------------------");

    FileUtils.deleteQuietly(new File("target/data/"));
    
    MockMailbox.resetAll();

    // Instantiates a local node & client

    esSetup =  new PluginAwareNode(getSettingsBuilder(false, true).build(), (Collection) Lists.newArrayList(MapperAttachmentsPlugin.class)).start();
    esSetup2 = new PluginAwareNode(getSettingsBuilder(true, false).build(), (Collection) Lists.newArrayList(MapperAttachmentsPlugin.class)).start();
    esSetup3 = new PluginAwareNode(getSettingsBuilder(false, true).build(), (Collection) Lists.newArrayList(MapperAttachmentsPlugin.class)).start();
    
    waitForGreenClusterState(esSetup.client());

}
 
開發者ID:salyh,項目名稱:elasticsearch-imap,代碼行數:19,代碼來源:AbstractIMAPRiverUnitTest.java


注:本文中的org.elasticsearch.mapper.attachments.MapperAttachmentsPlugin類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。