|
98 | 98 | import java.util.concurrent.TimeUnit; |
99 | 99 |
|
100 | 100 | import static org.elasticsearch.index.query.QueryBuilders.matchQuery; |
101 | | -import static org.hamcrest.Matchers.contains; |
102 | 101 | import static org.hamcrest.Matchers.containsInAnyOrder; |
103 | 102 | import static org.hamcrest.Matchers.containsString; |
104 | 103 | import static org.hamcrest.Matchers.equalTo; |
@@ -725,22 +724,26 @@ public void testFieldCaps() throws Exception { |
725 | 724 | // end::field-caps-execute |
726 | 725 |
|
727 | 726 | // tag::field-caps-response |
728 | | - assertThat(response.get().keySet(), contains("user")); |
729 | | - Map<String, FieldCapabilities> userResponse = response.getField("user"); |
730 | | - |
731 | | - assertThat(userResponse.keySet(), containsInAnyOrder("keyword", "text")); // <1> |
| 727 | + Map<String, FieldCapabilities> userResponse = response.getField("user"); // <1> |
732 | 728 | FieldCapabilities textCapabilities = userResponse.get("keyword"); |
733 | 729 |
|
734 | | - assertTrue(textCapabilities.isSearchable()); |
735 | | - assertFalse(textCapabilities.isAggregatable()); |
| 730 | + boolean isSearchable = textCapabilities.isSearchable(); |
| 731 | + boolean isAggregatable = textCapabilities.isAggregatable(); |
736 | 732 |
|
737 | | - assertArrayEquals(textCapabilities.indices(), // <2> |
738 | | - new String[]{"authors", "contributors"}); |
739 | | - assertNull(textCapabilities.nonSearchableIndices()); // <3> |
740 | | - assertArrayEquals(textCapabilities.nonAggregatableIndices(), // <4> |
741 | | - new String[]{"authors"}); |
| 733 | + String[] indices = textCapabilities.indices(); // <2> |
| 734 | + String[] nonSearchableIndices = textCapabilities.nonSearchableIndices(); // <3> |
| 735 | + String[] nonAggregatableIndices = textCapabilities.nonAggregatableIndices();//<4> |
742 | 736 | // end::field-caps-response |
743 | 737 |
|
| 738 | + assertThat(userResponse.keySet(), containsInAnyOrder("keyword", "text")); |
| 739 | + |
| 740 | + assertTrue(isSearchable); |
| 741 | + assertFalse(isAggregatable); |
| 742 | + |
| 743 | + assertArrayEquals(indices, new String[]{"authors", "contributors"}); |
| 744 | + assertNull(nonSearchableIndices); |
| 745 | + assertArrayEquals(nonAggregatableIndices, new String[]{"authors"}); |
| 746 | + |
744 | 747 | // tag::field-caps-execute-listener |
745 | 748 | ActionListener<FieldCapabilitiesResponse> listener = new ActionListener<FieldCapabilitiesResponse>() { |
746 | 749 | @Override |
|
0 commit comments