|
20 | 20 | package org.elasticsearch.action.admin.indices.create; |
21 | 21 |
|
22 | 22 | import com.carrotsearch.hppc.cursors.ObjectCursor; |
23 | | - |
24 | 23 | import org.elasticsearch.ElasticsearchException; |
25 | 24 | import org.elasticsearch.action.ActionListener; |
26 | 25 | import org.elasticsearch.action.UnavailableShardsException; |
|
29 | 28 | import org.elasticsearch.action.search.SearchResponse; |
30 | 29 | import org.elasticsearch.action.support.ActiveShardCount; |
31 | 30 | import org.elasticsearch.action.support.IndicesOptions; |
32 | | -import org.elasticsearch.client.Client; |
33 | 31 | import org.elasticsearch.cluster.ClusterState; |
34 | 32 | import org.elasticsearch.cluster.metadata.IndexMetaData; |
35 | 33 | import org.elasticsearch.cluster.metadata.MetaData; |
36 | 34 | import org.elasticsearch.cluster.node.DiscoveryNode; |
37 | 35 | import org.elasticsearch.common.collect.ImmutableOpenMap; |
38 | 36 | import org.elasticsearch.common.settings.Settings; |
39 | 37 | import org.elasticsearch.common.unit.TimeValue; |
40 | | -import org.elasticsearch.common.xcontent.XContentType; |
41 | 38 | import org.elasticsearch.env.NodeEnvironment; |
42 | 39 | import org.elasticsearch.index.IndexNotFoundException; |
43 | 40 | import org.elasticsearch.index.query.RangeQueryBuilder; |
@@ -403,69 +400,4 @@ public Settings onNodeStopped(String nodeName) throws Exception { |
403 | 400 | assertThat(e, hasToString(containsString("unknown setting [index.foo]"))); |
404 | 401 | } |
405 | 402 |
|
406 | | - /** |
407 | | - * This test method is used to generate the Put Mapping Java Indices API documentation |
408 | | - * at "docs/java-api/admin/indices/put-mapping.asciidoc" so the documentation gets tested |
409 | | - * so that it compiles and runs without throwing errors at runtime. |
410 | | - */ |
411 | | - public void testPutMappingDocumentation() throws Exception { |
412 | | - Client client = client(); |
413 | | - // tag::addMapping-create-index-request |
414 | | - client.admin().indices().prepareCreate("twitter") // <1> |
415 | | - .addMapping("tweet", "{\n" + // <2> |
416 | | - " \"tweet\": {\n" + |
417 | | - " \"properties\": {\n" + |
418 | | - " \"message\": {\n" + |
419 | | - " \"type\": \"text\"\n" + |
420 | | - " }\n" + |
421 | | - " }\n" + |
422 | | - " }\n" + |
423 | | - " }", XContentType.JSON) |
424 | | - .get(); |
425 | | - // end::addMapping-create-index-request |
426 | | - |
427 | | - // we need to delete in order to create a fresh new index with another type |
428 | | - client.admin().indices().prepareDelete("twitter").get(); |
429 | | - client.admin().indices().prepareCreate("twitter").get(); |
430 | | - |
431 | | - // tag::putMapping-request-source |
432 | | - client.admin().indices().preparePutMapping("twitter") // <1> |
433 | | - .setType("user") // <2> |
434 | | - .setSource("{\n" + // <3> |
435 | | - " \"properties\": {\n" + |
436 | | - " \"name\": {\n" + |
437 | | - " \"type\": \"text\"\n" + |
438 | | - " }\n" + |
439 | | - " }\n" + |
440 | | - "}", XContentType.JSON) |
441 | | - .get(); |
442 | | - |
443 | | - // You can also provide the type in the source document |
444 | | - client.admin().indices().preparePutMapping("twitter") |
445 | | - .setType("user") |
446 | | - .setSource("{\n" + |
447 | | - " \"user\":{\n" + // <4> |
448 | | - " \"properties\": {\n" + |
449 | | - " \"name\": {\n" + |
450 | | - " \"type\": \"text\"\n" + |
451 | | - " }\n" + |
452 | | - " }\n" + |
453 | | - " }\n" + |
454 | | - "}", XContentType.JSON) |
455 | | - .get(); |
456 | | - // end::putMapping-request-source |
457 | | - |
458 | | - // tag::putMapping-request-source-append |
459 | | - client.admin().indices().preparePutMapping("twitter") // <1> |
460 | | - .setType("user") // <2> |
461 | | - .setSource("{\n" + // <3> |
462 | | - " \"properties\": {\n" + |
463 | | - " \"user_name\": {\n" + |
464 | | - " \"type\": \"text\"\n" + |
465 | | - " }\n" + |
466 | | - " }\n" + |
467 | | - "}", XContentType.JSON) |
468 | | - .get(); |
469 | | - // end::putMapping-request-source-append |
470 | | - } |
471 | 403 | } |
0 commit comments