当前位置: 首页>>代码示例>>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;未经允许,请勿转载。