Skip to content

Commit

Permalink
iter
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Büscher committed Jul 16, 2018
1 parent 34514b2 commit a2a7f0c
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.ESIntegTestCase;

import java.util.HashMap;
import java.util.Map;

import static java.util.Collections.singletonMap;
import static org.hamcrest.Matchers.instanceOf;

Expand Down Expand Up @@ -96,8 +99,8 @@ public void testPutMappingDocumentation() throws Exception {
getMappingsResponse = client.admin().indices().prepareGetMappings("twitter").get();
assertEquals(1, getMappingsResponse.getMappings().size());
indexMapping = getMappingsResponse.getMappings().get("twitter");
assertEquals(indexMapping.get("user").getSourceAsMap(),
singletonMap("properties", singletonMap("name", singletonMap("type", "text"))));
assertEquals(singletonMap("properties", singletonMap("name", singletonMap("type", "text"))),
indexMapping.get("user").getSourceAsMap());

This comment has been minimized.

Copy link
@pcsanwald

pcsanwald Jul 16, 2018

Contributor

LGTM!


// tag::putMapping-request-source-append
client.admin().indices().preparePutMapping("twitter") // <1>
Expand All @@ -114,8 +117,10 @@ public void testPutMappingDocumentation() throws Exception {
getMappingsResponse = client.admin().indices().prepareGetMappings("twitter").get();
assertEquals(1, getMappingsResponse.getMappings().size());
indexMapping = getMappingsResponse.getMappings().get("twitter");
assertEquals(indexMapping.get("user").getSourceAsMap(),
singletonMap("properties", singletonMap("user_name", singletonMap("type", "text"))));
Map<String, Map<?,?>> expected = new HashMap<>();
expected.put("name", singletonMap("type", "text"));
expected.put("user_name", singletonMap("type", "text"));
assertEquals(expected, indexMapping.get("user").getSourceAsMap().get("properties"));
}

}

0 comments on commit a2a7f0c

Please sign in to comment.