• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EsSetup类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



EsSetup类属于com.github.tlrx.elasticsearch.test包,在下文中一共展示了EsSetup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: testDeDupMetrics

import com.github.tlrx.elasticsearch.test.EsSetup; //导入依赖的package包/类
@Test
public void testDeDupMetrics() throws Exception {
    // New index name and the locator to be written to it
    String ES_DUP = ElasticIO.ELASTICSEARCH_INDEX_NAME_WRITE + "_2";
    Locator testLocator = createTestLocator(TENANT_A, 0, "A", 0);
    // Metric is aleady there in old
    List<SearchResult> results = elasticIO.search(TENANT_A, testLocator.getMetricName());
    assertEquals(results.size(), 1);
    assertEquals(results.get(0).getMetricName(), testLocator.getMetricName());
    // Actually create the new index
    esSetup.execute(EsSetup.createIndex(ES_DUP)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("metrics", EsSetup.fromClassPath("metrics_mapping.json")));
    // Insert metric into the new index
    elasticIO.setINDEX_NAME_WRITE(ES_DUP);
    ArrayList metricList = new ArrayList();
    metricList.add(new Metric(createTestLocator(TENANT_A, 0, "A", 0), 987654321L, 0, new TimeValue(1, TimeUnit.DAYS), UNIT));
    elasticIO.insertDiscovery(metricList);
    esSetup.client().admin().indices().prepareRefresh().execute().actionGet();
    // Set up aliases
    esSetup.client().admin().indices().prepareAliases().addAlias(ES_DUP, "metric_metadata_read")
            .addAlias(ElasticIO.ELASTICSEARCH_INDEX_NAME_WRITE, "metric_metadata_read").execute().actionGet();
    elasticIO.setINDEX_NAME_READ("metric_metadata_read");
    results = elasticIO.search(TENANT_A, testLocator.getMetricName());
    // Should just be one result
    assertEquals(results.size(), 1);
    assertEquals(results.get(0).getMetricName(), testLocator.getMetricName());
    elasticIO.setINDEX_NAME_READ(ElasticIOConfig.ELASTICSEARCH_INDEX_NAME_READ.getDefaultValue());
    elasticIO.setINDEX_NAME_WRITE(ElasticIOConfig.ELASTICSEARCH_INDEX_NAME_WRITE.getDefaultValue());
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:31,代码来源:ElasticIOIntegrationTest.java


示例14: 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


示例15: 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


示例16: 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


示例17: setup

import com.github.tlrx.elasticsearch.test.EsSetup; //导入依赖的package包/类
@Before
public void setup() throws IOException {
    esSetup.execute(EsSetup.deleteAll());

    client = new ElasticClient(esSetup.client(), APPLICATION_NAME, true, 1);
    setMappingForTest();

    final Calendar visit = new GregorianCalendar();
    // Washington Monument
    washingtonMonument = new PlaceOfInterest();
    washingtonMonument.setTitle("Washington Monument");
    washingtonMonument.setComments(
            "The Washington Monument is an obelisk on the National Mall in "
                    + "Washington, D.C., built to commemorate George Washington, " +
                    "Commander-in-Chief of the Continental " + "Army and the first American president.");
    washingtonMonument.setTags(new String[] {"president", "monument"});
    washingtonMonument.setLocation(new Location(38.889468, -77.03524));
    washingtonMonument.setRating(92);
    washingtonMonument.setVisit(visit.getTime());
    washingtonMonumentDoc = TestUtils.generateDocument(TEST_TYPE, gson.toJson(washingtonMonument));
    // 42Six Columbia
    oneaaColumbia = new PlaceOfInterest();
    oneaaColumbia.setTitle("42Six HQ");
    oneaaColumbia.setComments(
            "The headquarters for 42Six from the initial split from Berico. Located at "
                    + "6630 Eli Whitney Dr. At one point the office included a gym, a fully stocked kitchen, " +
                    "a fully "
                    + "stocked fridge, and an occasional ommlette chef. There was also plenty of space and " +
                    "monitors for " + "all. Alas the good times have come to an end.");
    oneaaColumbia.setTags(new String[] {"hooray", "42six", "office", "sodas"});
    oneaaColumbia.setLocation(new Location(39.182786, -76.808853));
    oneaaColumbia.setRating(92);
    visit.add(Calendar.HOUR, -5);
    oneaaColumbia.setVisit(visit.getTime());
    oneaaColumbiaDoc = TestUtils.generateDocument(TEST_TYPE, gson.toJson(oneaaColumbia));
    // 42Six DC
    oneaaNavyYard = new PlaceOfInterest();
    oneaaNavyYard.setTitle("42Six Annex (Navy Yard)");
    oneaaNavyYard.setComments(
            "The third location in a year for 42Six in DC. A far cry from the HQ location, the DC "
                    + "annex has always been a step (or 10) down from the columbia location. With a skeleton crew "
                    + "of 1 - 6 employees the dc office is lucky to have a fridge that employees occasionally "
                    + "contribute to and coffee which is available cold (not the kind you order cold) and costs "
                    + "25 cents a cup.");
    oneaaNavyYard.setTags(new String[] {"dc", "new", "office"});
    oneaaNavyYard.setLocation(new Location(38.875945, -76.9895913));
    oneaaNavyYard.setRating(2);
    visit.add(Calendar.HOUR, -2);
    oneaaNavyYard.setVisit(visit.getTime());
    oneaaNavyYardDoc = TestUtils.generateDocument(TEST_TYPE, gson.toJson(oneaaNavyYard));
    // White House
    whiteHouse = new PlaceOfInterest();
    whiteHouse.setTitle("White House");
    whiteHouse.setComments(
            "The home of the president of the US located at 1600 Pennsylvania Ave. Since 1800 it has "
                    + "been the home of every US president and is really just a big white mansion with a large "
                    + "staff and a bunch of other stuff.");
    whiteHouse.setTags(new String[] {"dc", "white", "monument"});
    whiteHouse.setLocation(new Location(38.8977, -77.0365));
    whiteHouse.setRating(23);
    visit.add(Calendar.DAY_OF_MONTH, -3);
    whiteHouse.setVisit(visit.getTime());
    whiteHouseDoc = TestUtils.generateDocument(TEST_TYPE, gson.toJson(whiteHouse));
}
 
开发者ID:ezbake,项目名称:ezelastic,代码行数:65,代码来源:ElasticClientTest.java


示例18: deleteIndex

import com.github.tlrx.elasticsearch.test.EsSetup; //导入依赖的package包/类
private static void deleteIndex(String name) {
    if (esSetup.exists(name)) {
        esSetup.execute(EsSetup.deleteIndex(name));
    }
}
 
开发者ID:ezbake,项目名称:ezelastic,代码行数:6,代码来源:IT_EzElasticIntegrationTest.java


示例19: createIndexProbably

import com.github.tlrx.elasticsearch.test.EsSetup; //导入依赖的package包/类
private static void createIndexProbably(String name) {
    if (!esSetup.exists(name)) {
        esSetup.execute(EsSetup.createIndex(name));
    }
}
 
开发者ID:ezbake,项目名称:ezelastic,代码行数:6,代码来源:IT_EzElasticIntegrationTest.java


示例20: setup

import com.github.tlrx.elasticsearch.test.EsSetup; //导入依赖的package包/类
@Before
public void setup() throws IOException {
    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());

    elasticIO.insertDiscovery(createTestMetrics(TENANT_A));
    elasticIO.insertDiscovery(createTestMetrics(TENANT_B));
    elasticIO.insertDiscovery(createTestMetricsFromInterface(TENANT_C));

    esSetup.execute(EsSetup.createIndex(ElasticTokensIO.ELASTICSEARCH_TOKEN_INDEX_NAME_WRITE)
                           .withMapping("tokens", EsSetup.fromClassPath("tokens_mapping.json")));

    String TOKEN_INDEX_NAME_OLD = ElasticTokensIO.ELASTICSEARCH_TOKEN_INDEX_NAME_WRITE + "_v1";
    esSetup.execute(EsSetup.createIndex(TOKEN_INDEX_NAME_OLD)
                           .withMapping("tokens", EsSetup.fromClassPath("tokens_mapping.json")));

    elasticTokensIO = new ElasticTokensIO(esSetup.client()) {
        @Override
        protected String[] getIndexesToSearch() {
            return new String[] {ElasticTokensIO.ELASTICSEARCH_TOKEN_INDEX_NAME_READ,
                                 TOKEN_INDEX_NAME_OLD};
        }
    };

    //inserting to metric_tokens
    elasticTokensIO.insertDiscovery(createTestTokens(TENANT_A));
    elasticTokensIO.insertDiscovery(createTestTokens(TENANT_B));
    elasticTokensIO.insertDiscovery(createTestTokens(TENANT_C));

    //inserting same tokens to old version of metric_tokens
    this.insertTokenDiscovery(createTestTokens(TENANT_A), TOKEN_INDEX_NAME_OLD, esSetup.client());
    this.insertTokenDiscovery(createTestTokens(TENANT_B), TOKEN_INDEX_NAME_OLD, esSetup.client());
    this.insertTokenDiscovery(createTestTokens(TENANT_C), TOKEN_INDEX_NAME_OLD, esSetup.client());

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Architecture类代码示例发布时间:2022-05-22
下一篇:
Java EnvironmentContext类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap