|
26 | 26 | import org.elasticsearch.action.search.SearchResponse; |
27 | 27 | import org.elasticsearch.action.support.ActiveShardCount; |
28 | 28 | import org.elasticsearch.action.support.IndicesOptions; |
29 | | -import org.elasticsearch.client.Client; |
30 | 29 | import org.elasticsearch.cluster.ClusterState; |
31 | 30 | import org.elasticsearch.cluster.metadata.IndexMetaData; |
32 | 31 | import org.elasticsearch.cluster.metadata.MetaData; |
33 | 32 | import org.elasticsearch.common.collect.ImmutableOpenMap; |
34 | 33 | import org.elasticsearch.common.settings.Settings; |
35 | 34 | import org.elasticsearch.common.unit.TimeValue; |
36 | | -import org.elasticsearch.common.xcontent.XContentType; |
37 | 35 | import org.elasticsearch.index.IndexNotFoundException; |
38 | 36 | import org.elasticsearch.index.query.RangeQueryBuilder; |
39 | 37 | import org.elasticsearch.test.ESIntegTestCase; |
@@ -345,70 +343,4 @@ public void testIndexNameInResponse() { |
345 | 343 |
|
346 | 344 | assertEquals("Should have index name in response", "foo", response.index()); |
347 | 345 | } |
348 | | - |
349 | | - /** |
350 | | - * This test method is used to generate the Put Mapping Java Indices API documentation |
351 | | - * at "docs/java-api/admin/indices/put-mapping.asciidoc" so the documentation gets tested |
352 | | - * so that it compiles and runs without throwing errors at runtime. |
353 | | - */ |
354 | | - public void testPutMappingDocumentation() throws Exception { |
355 | | - Client client = client(); |
356 | | - // tag::addMapping-create-index-request |
357 | | - client.admin().indices().prepareCreate("twitter") // <1> |
358 | | - .addMapping("tweet", "{\n" + // <2> |
359 | | - " \"tweet\": {\n" + |
360 | | - " \"properties\": {\n" + |
361 | | - " \"message\": {\n" + |
362 | | - " \"type\": \"text\"\n" + |
363 | | - " }\n" + |
364 | | - " }\n" + |
365 | | - " }\n" + |
366 | | - " }", XContentType.JSON) |
367 | | - .get(); |
368 | | - // end::addMapping-create-index-request |
369 | | - |
370 | | - // we need to delete in order to create a fresh new index with another type |
371 | | - client.admin().indices().prepareDelete("twitter").get(); |
372 | | - client.admin().indices().prepareCreate("twitter").get(); |
373 | | - |
374 | | - // tag::putMapping-request-source |
375 | | - client.admin().indices().preparePutMapping("twitter") // <1> |
376 | | - .setType("user") // <2> |
377 | | - .setSource("{\n" + // <3> |
378 | | - " \"properties\": {\n" + |
379 | | - " \"name\": {\n" + |
380 | | - " \"type\": \"text\"\n" + |
381 | | - " }\n" + |
382 | | - " }\n" + |
383 | | - "}", XContentType.JSON) |
384 | | - .get(); |
385 | | - |
386 | | - // You can also provide the type in the source document |
387 | | - client.admin().indices().preparePutMapping("twitter") |
388 | | - .setType("user") |
389 | | - .setSource("{\n" + |
390 | | - " \"user\":{\n" + // <4> |
391 | | - " \"properties\": {\n" + |
392 | | - " \"name\": {\n" + |
393 | | - " \"type\": \"text\"\n" + |
394 | | - " }\n" + |
395 | | - " }\n" + |
396 | | - " }\n" + |
397 | | - "}", XContentType.JSON) |
398 | | - .get(); |
399 | | - // end::putMapping-request-source |
400 | | - |
401 | | - // tag::putMapping-request-source-append |
402 | | - client.admin().indices().preparePutMapping("twitter") // <1> |
403 | | - .setType("user") // <2> |
404 | | - .setSource("{\n" + // <3> |
405 | | - " \"properties\": {\n" + |
406 | | - " \"user_name\": {\n" + |
407 | | - " \"type\": \"text\"\n" + |
408 | | - " }\n" + |
409 | | - " }\n" + |
410 | | - "}", XContentType.JSON) |
411 | | - .get(); |
412 | | - // end::putMapping-request-source-append |
413 | | - } |
414 | 346 | } |
0 commit comments