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


Java JavaEsSpark.saveToEsWithMeta方法代码示例

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


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

示例1: testEsRDDWriteWithDynamicMapping

import org.elasticsearch.spark.rdd.api.java.JavaEsSpark; //导入方法依赖的package包/类
public void testEsRDDWriteWithDynamicMapping() throws Exception {
    Map<String, ?> doc1 = ImmutableMap.of("one", 1, "two", 2, "number", 1);
    Map<String, ?> doc2 = ImmutableMap.of("OTP", "Otopeni", "SFO", "San Fran", "number", 2);

    String target = "spark-test/java-dyn-id-write";
    JavaPairRDD<?, ?> pairRdd = sc.parallelizePairs(ImmutableList.of(new Tuple2<Object,Object>(1, doc1),
            new Tuple2<Object, Object>(2, doc2)));
    //JavaPairRDD pairRDD = JavaPairRDD.fromJavaRDD(tupleRdd);
    // eliminate with static import
    JavaEsSpark.saveToEsWithMeta(pairRdd, target);

    assertEquals(2, JavaEsSpark.esRDD(sc, target).count());
    assertTrue(RestUtils.exists(target + "/1"));
    assertTrue(RestUtils.exists(target + "/2"));
    String results = RestUtils.get(target + "/_search?");
    assertThat(results, containsString("SFO"));
}
 
开发者ID:xushjie1987,项目名称:es-hadoop-v2.2.0,代码行数:18,代码来源:AbstractJavaEsSparkTest.java

示例2: testEsRDDWriteWithDynamicMappingBasedOnMaps

import org.elasticsearch.spark.rdd.api.java.JavaEsSpark; //导入方法依赖的package包/类
public void testEsRDDWriteWithDynamicMappingBasedOnMaps() throws Exception {
    Map<String, ?> doc1 = ImmutableMap.of("one", 1, "two", 2, "number", 1);
    Map<String, ?> doc2 = ImmutableMap.of("OTP", "Otopeni", "SFO", "San Fran", "number", 2);

    String target = "spark-test/java-dyn-map-id-write";
    Map<Metadata, Object> header1 = ImmutableMap.<Metadata, Object> of(ID, 1, TTL, "1d");
    Map<Metadata, Object> header2 = ImmutableMap.<Metadata, Object> of(ID, "2", TTL, "2d");
    JavaRDD<Tuple2<Object, Object>> tupleRdd = sc.parallelize(ImmutableList.<Tuple2<Object, Object>> of(new Tuple2(header1, doc1), new Tuple2(header2, doc2)));
    JavaPairRDD pairRDD = JavaPairRDD.fromJavaRDD(tupleRdd);
    // eliminate with static import
    JavaEsSpark.saveToEsWithMeta(pairRDD, target);

    assertEquals(2, JavaEsSpark.esRDD(sc, target).count());
    assertTrue(RestUtils.exists(target + "/1"));
    assertTrue(RestUtils.exists(target + "/2"));
    String results = RestUtils.get(target + "/_search?");
    assertThat(results, containsString("SFO"));
}
 
开发者ID:xushjie1987,项目名称:es-hadoop-v2.2.0,代码行数:19,代码来源:AbstractJavaEsSparkTest.java

示例3: testEsRDDWriteWithDynamicMapping

import org.elasticsearch.spark.rdd.api.java.JavaEsSpark; //导入方法依赖的package包/类
public void testEsRDDWriteWithDynamicMapping() throws Exception {
    Map<String, ?> doc1 = ImmutableMap.of("one", 1, "two", 2, "number", 1);
    Map<String, ?> doc2 = ImmutableMap.of("OTP", "Otopeni", "SFO", "San Fran", "number", 2);

    String target = "spark-test-java-dyn-id-write/data";
    JavaPairRDD<?, ?> pairRdd = sc.parallelizePairs(ImmutableList.of(new Tuple2<Object,Object>(1, doc1),
            new Tuple2<Object, Object>(2, doc2)));
    //JavaPairRDD pairRDD = JavaPairRDD.fromJavaRDD(tupleRdd);
    // eliminate with static import
    JavaEsSpark.saveToEsWithMeta(pairRdd, target);

    assertEquals(2, JavaEsSpark.esRDD(sc, target).count());
    assertTrue(RestUtils.exists(target + "/1"));
    assertTrue(RestUtils.exists(target + "/2"));
    String results = RestUtils.get(target + "/_search?");
    assertThat(results, containsString("SFO"));
}
 
开发者ID:elastic,项目名称:elasticsearch-hadoop,代码行数:18,代码来源:AbstractJavaEsSparkTest.java

示例4: testEsRDDWriteWithDynamicMappingBasedOnMaps

import org.elasticsearch.spark.rdd.api.java.JavaEsSpark; //导入方法依赖的package包/类
public void testEsRDDWriteWithDynamicMappingBasedOnMaps() throws Exception {
    Map<String, ?> doc1 = ImmutableMap.of("one", 1, "two", 2, "number", 1);
    Map<String, ?> doc2 = ImmutableMap.of("OTP", "Otopeni", "SFO", "San Fran", "number", 2);

    String target = "spark-test-java-dyn-map-id-write/data";
    Map<Metadata, Object> header1 = ImmutableMap.<Metadata, Object> of(ID, 1, TTL, "1d");
    Map<Metadata, Object> header2 = ImmutableMap.<Metadata, Object> of(ID, "2", TTL, "2d");
    JavaRDD<Tuple2<Object, Object>> tupleRdd = sc.parallelize(ImmutableList.<Tuple2<Object, Object>> of(new Tuple2(header1, doc1), new Tuple2(header2, doc2)));
    JavaPairRDD pairRDD = JavaPairRDD.fromJavaRDD(tupleRdd);
    // eliminate with static import
    JavaEsSpark.saveToEsWithMeta(pairRDD, target);

    assertEquals(2, JavaEsSpark.esRDD(sc, target).count());
    assertTrue(RestUtils.exists(target + "/1"));
    assertTrue(RestUtils.exists(target + "/2"));
    String results = RestUtils.get(target + "/_search?");
    assertThat(results, containsString("SFO"));
}
 
开发者ID:elastic,项目名称:elasticsearch-hadoop,代码行数:19,代码来源:AbstractJavaEsSparkTest.java


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