当前位置: 首页>>代码示例>>Java>>正文


Java EsSetup.execute方法代码示例

本文整理汇总了Java中com.github.tlrx.elasticsearch.test.EsSetup.execute方法的典型用法代码示例。如果您正苦于以下问题:Java EsSetup.execute方法的具体用法?Java EsSetup.execute怎么用?Java EsSetup.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.tlrx.elasticsearch.test.EsSetup的用法示例。


在下文中一共展示了EsSetup.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUpClass

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception {
    final Settings settings = ImmutableSettings.settingsBuilder().put("script.disable_dynamic", false)
            .put("script.native.visibility.type", "ezbake.data.elastic.security.EzSecurityScriptFactory").build();

    esSetup = new EsSetup(settings);
    esSetup.execute(EsSetup.deleteAll());
    createIndexAndType();

    writeTestDoc("noVis", null, null, null, null, "noVisData");
    writeTestDoc("formalVisOnly", "TS&USA", null, null, null, "formalVisOnlyData");
    writeTestDoc("formalAndExternalVis", "TS&USA", "Foo&(Bar|Baz)", null, null, "formalAndExternalVisData");

    writeTestDoc(
            "allVis", "TS&USA", "Foo&(Bar|Baz)", Sets.newHashSet(92472393432L),
            Sets.newHashSet(324L, 43267L, 92472393432L), "allVisData");

    Thread.sleep(2000); // Wait for docs to be added
}
 
开发者ID:ezbake,项目名称:ezelastic,代码行数:20,代码来源:EzBakeVisibilityFilterIntegrationTest.java

示例2: setUpHttp

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setUpHttp() throws Exception {
    Configuration.getInstance().setProperty(CoreConfig.DISCOVERY_MODULES.name(),
            "com.rackspacecloud.blueflood.io.ElasticIO");
    Configuration.getInstance().setProperty(CoreConfig.USE_ES_FOR_UNITS.name(), "true");
    queryPort = Configuration.getInstance().getIntegerProperty(HttpConfig.HTTP_METRIC_DATA_QUERY_PORT);
    httpQueryService = new HttpQueryService();
    httpQueryService.startService();
    vendor = new HttpClientVendor();
    client = vendor.getClient();

    esSetup = new EsSetup();
    esSetup.execute(EsSetup.deleteAll());
    esSetup.execute(EsSetup.createIndex(ElasticIO.ELASTICSEARCH_INDEX_NAME_WRITE)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("metrics", EsSetup.fromClassPath("metrics_mapping.json")));
    elasticIO = new ElasticIO(esSetup.client());
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:19,代码来源:HttpRollupHandlerWithESIntegrationTest.java

示例3: setupElasticSearch

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
private static void setupElasticSearch() {
    // setup elasticsearch

    // setup config
    System.setProperty(CoreConfig.DISCOVERY_MODULES.name(), "com.rackspacecloud.blueflood.io.ElasticIO");
    System.setProperty(CoreConfig.EVENTS_MODULES.name(), "com.rackspacecloud.blueflood.io.EventElasticSearchIO");

    // setup elasticsearch test clusters with blueflood mappings
    esSetup = new EsSetup();
    esSetup.execute(EsSetup.deleteAll());
    esSetup.execute(EsSetup.createIndex(ElasticIO.ELASTICSEARCH_INDEX_NAME_WRITE)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("metrics", EsSetup.fromClassPath("metrics_mapping.json")));
    esSetup.execute(EsSetup.createIndex(EventElasticSearchIO.EVENT_INDEX)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("graphite_event", EsSetup.fromClassPath("events_mapping.json")));

    // create elaticsearch client and link it to ModuleLoader
    elasticIO = new ElasticIO(esSetup.client());
    eventsSearchIO = new EventElasticSearchIO(esSetup.client());
    ((ElasticIO) ModuleLoader.getInstance(DiscoveryIO.class, CoreConfig.DISCOVERY_MODULES)).setClient(esSetup.client());
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:23,代码来源:HttpIntegrationTestBase.java

示例4: setUp

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception{
    System.setProperty(CoreConfig.EVENTS_MODULES.name(), "com.rackspacecloud.blueflood.io.EventElasticSearchIO");
    Configuration.getInstance().init();
    httpPort = Configuration.getInstance().getIntegerProperty(HttpConfig.HTTP_INGESTION_PORT);
    manageShards.add(1); manageShards.add(5); manageShards.add(6);
    context = spy(new ScheduleContext(System.currentTimeMillis(), manageShards));

    esSetup = new EsSetup();
    esSetup.execute(EsSetup.deleteAll());
    esSetup.execute(EsSetup.createIndex(EventElasticSearchIO.EVENT_INDEX)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("graphite_event", EsSetup.fromClassPath("events_mapping.json")));
    eventsSearchIO = new EventElasticSearchIO(esSetup.client());
    server = new HttpMetricsIngestionServer(context);
    server.setHttpEventsIngestionHandler(new HttpEventsIngestionHandler(eventsSearchIO));

    server.startServer();

    vendor = new HttpClientVendor();
    client = vendor.getClient();
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:23,代码来源:HttpMetricsIngestionServerShutdownIntegrationTest.java

示例5: setup

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
    esSetup = new EsSetup();
    esSetup.execute(EsSetup.deleteAll());
    esSetup.execute(EsSetup
            .createIndex(EventElasticSearchIO.EVENT_INDEX)
            .withMapping(EventElasticSearchIO.ES_TYPE, EsSetup.fromClassPath("events_mapping.json")));
    searchIO = new EventElasticSearchIO(esSetup.client());

    createTestEvents(TENANT_1, TENANT_1_EVENTS_NUM);
    createTestEvents(TENANT_2, TENANT_2_EVENTS_NUM);
    createTestEvents(TENANT_WITH_SYMBOLS, TENANT_WITH_SYMBOLS_NUM);
    createRangeEvents(TENANT_RANGE, TENANT_RANGE_EVENTS_NUM, RANGE_STEP_IN_SECONDS);

    esSetup.client().admin().indices().prepareRefresh().execute().actionGet();
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:17,代码来源:EventElasticSearchIOTest.java

示例6: testWithMultipleNodes

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
/**
 * Export request must also work with multiple nodes.
 */
@Test
public void testWithMultipleNodes() {
    // Prepare a second node and wait for relocation
    esSetup2 = new EsSetup();
    esSetup2.execute(index("users", "d").withSource("{\"name\": \"motorbike\"}"));
    esSetup2.client().admin().cluster().prepareHealth().setWaitForGreenStatus().
        setWaitForNodes("2").setWaitForRelocatingShards(0).execute().actionGet();

    // Do export request
    String source = "{\"output_cmd\": \"cat\", \"fields\": [\"name\"]}";
    ExportRequest exportRequest = new ExportRequest();
    exportRequest.source(source);
    ExportResponse response = esSetup2.client().execute(
            ExportAction.INSTANCE, exportRequest).actionGet();

    // The two shard results are from different nodes and have no failures
    assertEquals(0, response.getFailedShards());
    List<Map<String, Object>> infos = getExports(response);
    assertNotSame(infos.get(0).get("node_id"), infos.get(1).get("node_id"));
}
 
开发者ID:crate,项目名称:elasticsearch-inout-plugin,代码行数:24,代码来源:RestExportActionTest.java

示例7: testExportRelativeFilename

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
/**
 * If the path of the output file is relative, the files are put to the data directory
 * of each node in a sub directory /export .
 */
@Test
public void testExportRelativeFilename() {
    esSetup2 = new EsSetup();
    esSetup2.execute(index("users", "d").withSource("{\"name\": \"motorbike\"}"));
    esSetup2.client().admin().cluster().prepareHealth().setWaitForGreenStatus().
        setWaitForNodes("2").setWaitForRelocatingShards(0).execute().actionGet();

    ExportResponse response = executeExportRequest(
            "{\"output_file\": \"export.${shard}.${index}.json\", \"fields\": [\"name\", \"_id\"], \"force_overwrite\": true}");

    List<Map<String, Object>> infos = getExports(response);
    assertEquals(2, infos.size());
    String output_file_0 = infos.get(0).get("output_file").toString();
    String output_file_1 = infos.get(1).get("output_file").toString();
    Pattern p = Pattern.compile("(.*)/nodes/(\\d)/export.(\\d).users.json");
    Matcher m0 = p.matcher(output_file_0);
    Matcher m1 = p.matcher(output_file_1);
    assertTrue(m0.find());
    assertTrue(m1.find());
    assertTrue(m0.group(2) != m1.group(2));
}
 
开发者ID:crate,项目名称:elasticsearch-inout-plugin,代码行数:26,代码来源:RestExportActionTest.java

示例8: setESandMongodb

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setESandMongodb() throws IOException {
    // Instantiates a local node & client
    esSetup = new EsSetup();
    // Clean all, and creates some indices
    esSetup.execute(
            deleteAll(),
            createIndex("my_index_1")
                    //.withMapping("annotation", fromClassPath("/home/azhar/NetBeansProjects/anHALytics-core/anhalytics-index/src/main/resources/elasticSearch/annotation.json"))
            ,
            createIndex("my_index_2")
                    //.withMapping("npl", fromClassPath("/home/azhar/NetBeansProjects/anHALytics-core/anhalytics-index/src/main/resources/elasticSearch/npl.json"))
                    //.withData(fromClassPath("path/to/bulk.json"))
    );
    
    
    _mongodExe = starter.prepare(new MongodConfigBuilder()
            .version(Version.Main.PRODUCTION)
            .net(new Net(12345, Network.localhostIsIPv6()))
            .build());
    _mongod = _mongodExe.start();

    MongoClient _mongo = new MongoClient("localhost", 12345);
    db = _mongo.getDB(DATABASE_NAME);
    (mm = new MongoManager(true)).setDB(db);
    System.out.println("ElasticSearch and Mongodb are ready to use...");
}
 
开发者ID:anHALytics,项目名称:anhalytics-core,代码行数:28,代码来源:ProcessTest.java

示例9: setUp

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@Before
public void setUp() {
    esSetup = new EsSetup(settings);
    esSetup.execute(createIndex(index));

    drpc = new LocalDRPC();
    StormTopology topology = buildTopology();

    cluster = new LocalCluster();
    cluster.submitTopology("elastic-storm", new Config(), topology);

    Utils.sleep(10000); // let's do some work
}
 
开发者ID:fhussonnois,项目名称:storm-trident-elasticsearch,代码行数:14,代码来源:BaseLocalClusterTest.java

示例10: setupClass

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setupClass() throws Exception {
    final Settings settings = ImmutableSettings.settingsBuilder().put("script.disable_dynamic", false)
            .put("script.native.visibility.type", "ezbake.data.elastic.security.EzSecurityScriptFactory").build();

    esSetup = new EsSetup(settings);
    esSetup.execute(EsSetup.deleteAll());

    if (esSetup.client() == null) {
        throw new Exception("Could not start EsSetup node!");
    }
}
 
开发者ID:ezbake,项目名称:ezelastic,代码行数:13,代码来源:ElasticClientTest.java

示例11: setUpClass

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception {
    gson = new GsonBuilder().setDateFormat("ddHHmm'Z' MMM yy").create();
    configuration = new EzConfiguration(new ClasspathConfigurationLoader()).getProperties();

    final EzBakeApplicationConfigurationHelper appConfig = new EzBakeApplicationConfigurationHelper(configuration);

    final String securityId = appConfig.getSecurityID();
    fakeSecurity =
            ThriftTestUtils.generateTestSecurityToken(securityId, securityId, Collections.singletonList("U"));
    applicationName = appConfig.getApplicationName();
    configuration.setProperty(EzBakePropertyConstants.ELASTICSEARCH_CLUSTER_NAME, "elasticsearch");
    final ElasticsearchConfigurationHelper helper = new ElasticsearchConfigurationHelper(configuration);

    final Settings settings = ImmutableSettings.settingsBuilder()
            .put("script.native.visibility.type", "ezbake.data.elastic.security.EzSecurityScriptFactory")
            .put("cluster.name", helper.getElasticsearchClusterName()).put("script.disable_dynamic", false)
            .put("network.host", helper.getElasticsearchHost())
            .put("transport.tcp.port", helper.getElasticsearchPort()).put("node.local", false).build();

    esSetup = new EsSetup(settings);
    esSetup.execute(EsSetup.deleteAll());

    if (esSetup.client() == null) {
        throw new Exception("Could not start EsSetup node!");
    }
}
 
开发者ID:ezbake,项目名称:ezelastic,代码行数:28,代码来源:IT_EzElasticIntegrationTest.java

示例12: setUp

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
    System.setProperty(CoreConfig.EVENTS_MODULES.name(), "com.rackspacecloud.blueflood.io.EventElasticSearchIO");
    Configuration.getInstance().init();
    httpPort = Configuration.getInstance().getIntegerProperty(HttpConfig.HTTP_INGESTION_PORT);
    queryPort = Configuration.getInstance().getIntegerProperty(HttpConfig.HTTP_METRIC_DATA_QUERY_PORT);
    manageShards.add(1); manageShards.add(5); manageShards.add(6);
    context = spy(new ScheduleContext(System.currentTimeMillis(), manageShards));

    esSetup = new EsSetup();
    esSetup.execute(EsSetup.deleteAll());
    esSetup.execute(EsSetup.createIndex(EventElasticSearchIO.EVENT_INDEX)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("graphite_event", EsSetup.fromClassPath("events_mapping.json")));
    eventsSearchIO = new EventElasticSearchIO(esSetup.client());
    HttpMetricsIngestionServer server = new HttpMetricsIngestionServer(context);
    server.setHttpEventsIngestionHandler(new HttpEventsIngestionHandler(eventsSearchIO));

    httpIngestionService = new HttpIngestionService();
    httpIngestionService.setMetricsIngestionServer(server);
    httpIngestionService.startService(context);

    httpQueryService = new HttpQueryService();
    HttpMetricDataQueryServer queryServer = new HttpMetricDataQueryServer();
    queryServer.setEventsIO(eventsSearchIO);
    httpQueryService.setServer(queryServer);
    httpQueryService.startService();

    vendor = new HttpClientVendor();
    client = vendor.getClient();
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:32,代码来源:HttpAnnotationsEndToEndTest.java

示例13: testWithMultipleNodes

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
/**
 * Dump request must also work with multiple nodes.
 */
@Test
public void testWithMultipleNodes() {

    // make sure target directory exists and is empty
    File dumpDir = new File("/tmp/multipleNodes");
    if (dumpDir.exists()) {
        for (File c : dumpDir.listFiles()) {
            c.delete();
        }
        dumpDir.delete();
    }
    dumpDir.mkdir();

    // Prepare a second node and wait for relocation
    esSetup2 = new EsSetup();
    esSetup2.execute(index("users", "d").withSource("{\"name\": \"motorbike\"}"));
    esSetup2.client().admin().cluster().prepareHealth().setWaitForGreenStatus().
        setWaitForNodes("2").setWaitForRelocatingShards(0).execute().actionGet();

    // Do dump request
    String source = "{\"force_overwrite\": true, \"directory\":\"/tmp/multipleNodes\"}";
    ExportRequest exportRequest = new ExportRequest();
    exportRequest.source(source);
    ExportResponse response = esSetup.client().execute(
            DumpAction.INSTANCE, exportRequest).actionGet();

    // The two shard results are from different nodes and have no failures
    assertEquals(0, response.getFailedShards());
    List<Map<String, Object>> infos = getExports(response);
    assertNotSame(infos.get(0).get("node_id"), infos.get(1).get("node_id"));
}
 
开发者ID:crate,项目名称:elasticsearch-inout-plugin,代码行数:35,代码来源:RestDumpActionTest.java

示例14: setUp

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@Before
public void setUp() {
    esSetup = new EsSetup();
    esSetup.execute(deleteAll(), createIndex("users").withSettings(
            fromClassPath("essetup/settings/test_a.json")).withMapping("d",
                    fromClassPath("essetup/mappings/test_a.json")).withData(
                            fromClassPath("essetup/data/test_a.json")));
    esSetup.client().admin().indices().prepareRefresh("users").execute();
}
 
开发者ID:crate,项目名称:elasticsearch-inout-plugin,代码行数:10,代码来源:AbstractRestActionTest.java

示例15: before

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@Before
public void before() {
  String nodeImports = "org.elasticsearch.*";
  Settings settings = ImmutableSettings.builder().put(JavaPlugin.SCRIPT_JAVA_IMPORTS, nodeImports).build();
  es = new EsSetup(settings);
  es.execute(createIndex("index1"));
}
 
开发者ID:btiernay,项目名称:elasticsearch-lang-java,代码行数:8,代码来源:JavaPluginTest.java


注:本文中的com.github.tlrx.elasticsearch.test.EsSetup.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。