@Test public void testEsdataFrame1WriteWithId() throws Exception { DataFrame dataFrame = artistsAsDataFrame(); String target = "sparksql-test/scala-basic-write-id-mapping"; JavaEsSparkSQL.saveToEs(dataFrame, target, ImmutableMap.of(ES_MAPPING_ID, "id")); assertTrue(RestUtils.exists(target)); assertThat(RestUtils.get(target + "/_search?"), containsString("345")); assertThat(RestUtils.exists(target + "/1"), is(true)); }
@Test public void testEsdataFrame1Write() throws Exception { DataFrame dataFrame = artistsAsDataFrame(); String target = "sparksql-test/scala-basic-write"; JavaEsSparkSQL.saveToEs(dataFrame, target); assertTrue(RestUtils.exists(target)); assertThat(RestUtils.get(target + "/_search?"), containsString("345")); }
@Test public void testEsSchemaRDD1WriteWithMappingExclude() throws Exception { DataFrame dataFrame = artistsAsDataFrame(); String target = "sparksql-test/scala-basic-write-exclude-mapping"; JavaEsSparkSQL.saveToEs(dataFrame, target, ImmutableMap.of(ES_MAPPING_EXCLUDE, "url")); assertTrue(RestUtils.exists(target)); assertThat(RestUtils.get(target + "/_search?"), not(containsString("url"))); }
@Test public void testDynamicPatternWithFormat() throws Exception { Assert.assertTrue(RestUtils.exists(indexPrefix + "cascading-local/pattern-format-2001-10-06")); Assert.assertTrue(RestUtils.exists(indexPrefix + "cascading-local/pattern-format-2198-10-06")); Assert.assertTrue(RestUtils.exists(indexPrefix + "cascading-local/pattern-format-2890-10-06")); }
@Test public void testDynamicPattern() throws Exception { Assert.assertTrue(RestUtils.exists(indexPrefix + "cascading-local/pattern-1")); Assert.assertTrue(RestUtils.exists(indexPrefix + "cascading-local/pattern-500")); Assert.assertTrue(RestUtils.exists(indexPrefix + "cascading-local/pattern-990")); }