|
@@ -145,9 +145,9 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
request.indicesOptions(indicesOptions); // <4>
|
|
|
// end::indices-exists-request-optionals
|
|
|
|
|
|
- // tag::indices-exists-response
|
|
|
+ // tag::indices-exists-execute
|
|
|
boolean exists = client.indices().exists(request, RequestOptions.DEFAULT);
|
|
|
- // end::indices-exists-response
|
|
|
+ // end::indices-exists-execute
|
|
|
assertTrue(exists);
|
|
|
}
|
|
|
}
|
|
@@ -182,9 +182,9 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
final CountDownLatch latch = new CountDownLatch(1);
|
|
|
listener = new LatchedActionListener<>(listener, latch);
|
|
|
|
|
|
- // tag::indices-exists-async
|
|
|
+ // tag::indices-exists-execute-async
|
|
|
client.indices().existsAsync(request, RequestOptions.DEFAULT, listener); // <1>
|
|
|
- // end::indices-exists-async
|
|
|
+ // end::indices-exists-execute-async
|
|
|
|
|
|
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
|
|
}
|
|
@@ -601,30 +601,30 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
}
|
|
|
|
|
|
{
|
|
|
- // tag::get-mapping-request
|
|
|
+ // tag::get-mappings-request
|
|
|
GetMappingsRequest request = new GetMappingsRequest(); // <1>
|
|
|
request.indices("twitter"); // <2>
|
|
|
request.types("_doc"); // <3>
|
|
|
- // end::get-mapping-request
|
|
|
+ // end::get-mappings-request
|
|
|
|
|
|
- // tag::get-mapping-request-masterTimeout
|
|
|
+ // tag::get-mappings-request-masterTimeout
|
|
|
request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); // <1>
|
|
|
request.masterNodeTimeout("1m"); // <2>
|
|
|
- // end::get-mapping-request-masterTimeout
|
|
|
+ // end::get-mappings-request-masterTimeout
|
|
|
|
|
|
- // tag::get-mapping-request-indicesOptions
|
|
|
+ // tag::get-mappings-request-indicesOptions
|
|
|
request.indicesOptions(IndicesOptions.lenientExpandOpen()); // <1>
|
|
|
- // end::get-mapping-request-indicesOptions
|
|
|
+ // end::get-mappings-request-indicesOptions
|
|
|
|
|
|
- // tag::get-mapping-execute
|
|
|
+ // tag::get-mappings-execute
|
|
|
GetMappingsResponse getMappingResponse = client.indices().getMapping(request, RequestOptions.DEFAULT);
|
|
|
- // end::get-mapping-execute
|
|
|
+ // end::get-mappings-execute
|
|
|
|
|
|
- // tag::get-mapping-response
|
|
|
+ // tag::get-mappings-response
|
|
|
ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> allMappings = getMappingResponse.mappings(); // <1>
|
|
|
MappingMetaData typeMapping = allMappings.get("twitter").get("_doc"); // <2>
|
|
|
Map<String, Object> mapping = typeMapping.sourceAsMap(); // <3>
|
|
|
- // end::get-mapping-response
|
|
|
+ // end::get-mappings-response
|
|
|
|
|
|
Map<String, String> type = new HashMap<>();
|
|
|
type.put("type", "text");
|
|
@@ -662,7 +662,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
request.indices("twitter");
|
|
|
request.types("_doc");
|
|
|
|
|
|
- // tag::get-mapping-execute-listener
|
|
|
+ // tag::get-mappings-execute-listener
|
|
|
ActionListener<GetMappingsResponse> listener =
|
|
|
new ActionListener<GetMappingsResponse>() {
|
|
|
@Override
|
|
@@ -675,7 +675,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
// <2>
|
|
|
}
|
|
|
};
|
|
|
- // end::get-mapping-execute-listener
|
|
|
+ // end::get-mappings-execute-listener
|
|
|
|
|
|
// Replace the empty listener by a blocking listener in test
|
|
|
final CountDownLatch latch = new CountDownLatch(1);
|
|
@@ -698,9 +698,9 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
fail("should not fail");
|
|
|
});
|
|
|
|
|
|
- // tag::get-mapping-execute-async
|
|
|
+ // tag::get-mappings-execute-async
|
|
|
client.indices().getMappingAsync(request, RequestOptions.DEFAULT, listener); // <1>
|
|
|
- // end::get-mapping-execute-async
|
|
|
+ // end::get-mappings-execute-async
|
|
|
|
|
|
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
|
|
}
|
|
@@ -731,29 +731,29 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
assertTrue(putMappingResponse.isAcknowledged());
|
|
|
}
|
|
|
|
|
|
- // tag::get-field-mapping-request
|
|
|
+ // tag::get-field-mappings-request
|
|
|
GetFieldMappingsRequest request = new GetFieldMappingsRequest(); // <1>
|
|
|
request.indices("twitter"); // <2>
|
|
|
request.types("_doc"); // <3>
|
|
|
request.fields("message", "timestamp"); // <4>
|
|
|
- // end::get-field-mapping-request
|
|
|
+ // end::get-field-mappings-request
|
|
|
|
|
|
- // tag::get-field-mapping-request-indicesOptions
|
|
|
+ // tag::get-field-mappings-request-indicesOptions
|
|
|
request.indicesOptions(IndicesOptions.lenientExpandOpen()); // <1>
|
|
|
- // end::get-field-mapping-request-indicesOptions
|
|
|
+ // end::get-field-mappings-request-indicesOptions
|
|
|
|
|
|
- // tag::get-field-mapping-request-local
|
|
|
+ // tag::get-field-mappings-request-local
|
|
|
request.local(true); // <1>
|
|
|
- // end::get-field-mapping-request-local
|
|
|
+ // end::get-field-mappings-request-local
|
|
|
|
|
|
{
|
|
|
|
|
|
- // tag::get-field-mapping-execute
|
|
|
+ // tag::get-field-mappings-execute
|
|
|
GetFieldMappingsResponse response =
|
|
|
client.indices().getFieldMapping(request, RequestOptions.DEFAULT);
|
|
|
- // end::get-field-mapping-execute
|
|
|
+ // end::get-field-mappings-execute
|
|
|
|
|
|
- // tag::get-field-mapping-response
|
|
|
+ // tag::get-field-mappings-response
|
|
|
final Map<String, Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetaData>>> mappings =
|
|
|
response.mappings();// <1>
|
|
|
final Map<String, GetFieldMappingsResponse.FieldMappingMetaData> typeMappings =
|
|
@@ -763,11 +763,11 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
|
|
|
final String fullName = metaData.fullName();// <4>
|
|
|
final Map<String, Object> source = metaData.sourceAsMap(); // <5>
|
|
|
- // end::get-field-mapping-response
|
|
|
+ // end::get-field-mappings-response
|
|
|
}
|
|
|
|
|
|
{
|
|
|
- // tag::get-field-mapping-execute-listener
|
|
|
+ // tag::get-field-mappings-execute-listener
|
|
|
ActionListener<GetFieldMappingsResponse> listener =
|
|
|
new ActionListener<GetFieldMappingsResponse>() {
|
|
|
@Override
|
|
@@ -780,7 +780,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
// <2>
|
|
|
}
|
|
|
};
|
|
|
- // end::get-field-mapping-execute-listener
|
|
|
+ // end::get-field-mappings-execute-listener
|
|
|
|
|
|
// Replace the empty listener by a blocking listener in test
|
|
|
final CountDownLatch latch = new CountDownLatch(1);
|
|
@@ -800,9 +800,9 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
fail("should not fail");
|
|
|
});
|
|
|
|
|
|
- // tag::get-field-mapping-execute-async
|
|
|
+ // tag::get-field-mappings-execute-async
|
|
|
client.indices().getFieldMappingAsync(request, RequestOptions.DEFAULT, listener); // <1>
|
|
|
- // end::get-field-mapping-execute-async
|
|
|
+ // end::get-field-mappings-execute-async
|
|
|
|
|
|
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
|
|
}
|
|
@@ -1002,7 +1002,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
// tag::flush-execute-listener
|
|
|
ActionListener<FlushResponse> listener = new ActionListener<FlushResponse>() {
|
|
|
@Override
|
|
|
- public void onResponse(FlushResponse refreshResponse) {
|
|
|
+ public void onResponse(FlushResponse flushResponse) {
|
|
|
// <1>
|
|
|
}
|
|
|
|
|
@@ -1571,7 +1571,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
// end::exists-alias-execute
|
|
|
assertTrue(exists);
|
|
|
|
|
|
- // tag::exists-alias-listener
|
|
|
+ // tag::exists-alias-execute-listener
|
|
|
ActionListener<Boolean> listener = new ActionListener<Boolean>() {
|
|
|
@Override
|
|
|
public void onResponse(Boolean exists) {
|
|
@@ -1583,7 +1583,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
// <2>
|
|
|
}
|
|
|
};
|
|
|
- // end::exists-alias-listener
|
|
|
+ // end::exists-alias-execute-listener
|
|
|
|
|
|
// Replace the empty listener by a blocking listener in test
|
|
|
final CountDownLatch latch = new CountDownLatch(1);
|
|
@@ -1844,44 +1844,44 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
client.indices().create(new CreateIndexRequest("index-1").alias(new Alias("alias")), RequestOptions.DEFAULT);
|
|
|
}
|
|
|
|
|
|
- // tag::rollover-request
|
|
|
+ // tag::rollover-index-request
|
|
|
RolloverRequest request = new RolloverRequest("alias", "index-2"); // <1>
|
|
|
request.addMaxIndexAgeCondition(new TimeValue(7, TimeUnit.DAYS)); // <2>
|
|
|
request.addMaxIndexDocsCondition(1000); // <3>
|
|
|
request.addMaxIndexSizeCondition(new ByteSizeValue(5, ByteSizeUnit.GB)); // <4>
|
|
|
- // end::rollover-request
|
|
|
+ // end::rollover-index-request
|
|
|
|
|
|
- // tag::rollover-request-timeout
|
|
|
+ // tag::rollover-index-request-timeout
|
|
|
request.timeout(TimeValue.timeValueMinutes(2)); // <1>
|
|
|
request.timeout("2m"); // <2>
|
|
|
- // end::rollover-request-timeout
|
|
|
- // tag::rollover-request-masterTimeout
|
|
|
+ // end::rollover-index-request-timeout
|
|
|
+ // tag::rollover-index-request-masterTimeout
|
|
|
request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); // <1>
|
|
|
request.masterNodeTimeout("1m"); // <2>
|
|
|
- // end::rollover-request-masterTimeout
|
|
|
- // tag::rollover-request-dryRun
|
|
|
+ // end::rollover-index-request-masterTimeout
|
|
|
+ // tag::rollover-index-request-dryRun
|
|
|
request.dryRun(true); // <1>
|
|
|
- // end::rollover-request-dryRun
|
|
|
- // tag::rollover-request-waitForActiveShards
|
|
|
+ // end::rollover-index-request-dryRun
|
|
|
+ // tag::rollover-index-request-waitForActiveShards
|
|
|
request.getCreateIndexRequest().waitForActiveShards(2); // <1>
|
|
|
request.getCreateIndexRequest().waitForActiveShards(ActiveShardCount.DEFAULT); // <2>
|
|
|
- // end::rollover-request-waitForActiveShards
|
|
|
- // tag::rollover-request-settings
|
|
|
+ // end::rollover-index-request-waitForActiveShards
|
|
|
+ // tag::rollover-index-request-settings
|
|
|
request.getCreateIndexRequest().settings(Settings.builder()
|
|
|
.put("index.number_of_shards", 4)); // <1>
|
|
|
- // end::rollover-request-settings
|
|
|
- // tag::rollover-request-mapping
|
|
|
+ // end::rollover-index-request-settings
|
|
|
+ // tag::rollover-index-request-mapping
|
|
|
request.getCreateIndexRequest().mapping("type", "field", "type=keyword"); // <1>
|
|
|
- // end::rollover-request-mapping
|
|
|
- // tag::rollover-request-alias
|
|
|
+ // end::rollover-index-request-mapping
|
|
|
+ // tag::rollover-index-request-alias
|
|
|
request.getCreateIndexRequest().alias(new Alias("another_alias")); // <1>
|
|
|
- // end::rollover-request-alias
|
|
|
+ // end::rollover-index-request-alias
|
|
|
|
|
|
- // tag::rollover-execute
|
|
|
+ // tag::rollover-index-execute
|
|
|
RolloverResponse rolloverResponse = client.indices().rollover(request, RequestOptions.DEFAULT);
|
|
|
- // end::rollover-execute
|
|
|
+ // end::rollover-index-execute
|
|
|
|
|
|
- // tag::rollover-response
|
|
|
+ // tag::rollover-index-response
|
|
|
boolean acknowledged = rolloverResponse.isAcknowledged(); // <1>
|
|
|
boolean shardsAcked = rolloverResponse.isShardsAcknowledged(); // <2>
|
|
|
String oldIndex = rolloverResponse.getOldIndex(); // <3>
|
|
@@ -1889,7 +1889,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
boolean isRolledOver = rolloverResponse.isRolledOver(); // <5>
|
|
|
boolean isDryRun = rolloverResponse.isDryRun(); // <6>
|
|
|
Map<String, Boolean> conditionStatus = rolloverResponse.getConditionStatus();// <7>
|
|
|
- // end::rollover-response
|
|
|
+ // end::rollover-index-response
|
|
|
assertFalse(acknowledged);
|
|
|
assertFalse(shardsAcked);
|
|
|
assertEquals("index-1", oldIndex);
|
|
@@ -1898,7 +1898,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
assertTrue(isDryRun);
|
|
|
assertEquals(3, conditionStatus.size());
|
|
|
|
|
|
- // tag::rollover-execute-listener
|
|
|
+ // tag::rollover-index-execute-listener
|
|
|
ActionListener<RolloverResponse> listener = new ActionListener<RolloverResponse>() {
|
|
|
@Override
|
|
|
public void onResponse(RolloverResponse rolloverResponse) {
|
|
@@ -1910,15 +1910,15 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
// <2>
|
|
|
}
|
|
|
};
|
|
|
- // end::rollover-execute-listener
|
|
|
+ // end::rollover-index-execute-listener
|
|
|
|
|
|
// Replace the empty listener by a blocking listener in test
|
|
|
final CountDownLatch latch = new CountDownLatch(1);
|
|
|
listener = new LatchedActionListener<>(listener, latch);
|
|
|
|
|
|
- // tag::rollover-execute-async
|
|
|
+ // tag::rollover-index-execute-async
|
|
|
client.indices().rolloverAsync(request, RequestOptions.DEFAULT, listener); // <1>
|
|
|
- // end::rollover-execute-async
|
|
|
+ // end::rollover-index-execute-async
|
|
|
|
|
|
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
|
|
}
|
|
@@ -1967,7 +1967,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
assertThat(response.getAliases().get("index").size(), equalTo(1));
|
|
|
assertThat(response.getAliases().get("index").iterator().next().alias(), equalTo("alias"));
|
|
|
|
|
|
- // tag::get-alias-listener
|
|
|
+ // tag::get-alias-execute-listener
|
|
|
ActionListener<GetAliasesResponse> listener =
|
|
|
new ActionListener<GetAliasesResponse>() {
|
|
|
@Override
|
|
@@ -1980,7 +1980,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
// <2>
|
|
|
}
|
|
|
};
|
|
|
- // end::get-alias-listener
|
|
|
+ // end::get-alias-execute-listener
|
|
|
|
|
|
// Replace the empty listener by a blocking listener in test
|
|
|
final CountDownLatch latch = new CountDownLatch(1);
|
|
@@ -2003,74 +2003,74 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
assertTrue(createIndexResponse.isAcknowledged());
|
|
|
}
|
|
|
|
|
|
- // tag::put-settings-request
|
|
|
+ // tag::indices-put-settings-request
|
|
|
UpdateSettingsRequest request = new UpdateSettingsRequest("index1"); // <1>
|
|
|
UpdateSettingsRequest requestMultiple =
|
|
|
new UpdateSettingsRequest("index1", "index2"); // <2>
|
|
|
UpdateSettingsRequest requestAll = new UpdateSettingsRequest(); // <3>
|
|
|
- // end::put-settings-request
|
|
|
+ // end::indices-put-settings-request
|
|
|
|
|
|
- // tag::put-settings-create-settings
|
|
|
+ // tag::indices-put-settings-create-settings
|
|
|
String settingKey = "index.number_of_replicas";
|
|
|
int settingValue = 0;
|
|
|
Settings settings =
|
|
|
Settings.builder()
|
|
|
.put(settingKey, settingValue)
|
|
|
.build(); // <1>
|
|
|
- // end::put-settings-create-settings
|
|
|
- // tag::put-settings-request-index-settings
|
|
|
+ // end::indices-put-settings-create-settings
|
|
|
+ // tag::indices-put-settings-request-index-settings
|
|
|
request.settings(settings);
|
|
|
- // end::put-settings-request-index-settings
|
|
|
+ // end::indices-put-settings-request-index-settings
|
|
|
|
|
|
{
|
|
|
- // tag::put-settings-settings-builder
|
|
|
+ // tag::indices-put-settings-settings-builder
|
|
|
Settings.Builder settingsBuilder =
|
|
|
Settings.builder()
|
|
|
.put(settingKey, settingValue);
|
|
|
request.settings(settingsBuilder); // <1>
|
|
|
- // end::put-settings-settings-builder
|
|
|
+ // end::indices-put-settings-settings-builder
|
|
|
}
|
|
|
{
|
|
|
- // tag::put-settings-settings-map
|
|
|
+ // tag::indices-put-settings-settings-map
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put(settingKey, settingValue);
|
|
|
request.settings(map); // <1>
|
|
|
- // end::put-settings-settings-map
|
|
|
+ // end::indices-put-settings-settings-map
|
|
|
}
|
|
|
{
|
|
|
- // tag::put-settings-settings-source
|
|
|
+ // tag::indices-put-settings-settings-source
|
|
|
request.settings(
|
|
|
"{\"index.number_of_replicas\": \"2\"}"
|
|
|
, XContentType.JSON); // <1>
|
|
|
- // end::put-settings-settings-source
|
|
|
+ // end::indices-put-settings-settings-source
|
|
|
}
|
|
|
|
|
|
- // tag::put-settings-request-preserveExisting
|
|
|
+ // tag::indices-put-settings-request-preserveExisting
|
|
|
request.setPreserveExisting(false); // <1>
|
|
|
- // end::put-settings-request-preserveExisting
|
|
|
- // tag::put-settings-request-timeout
|
|
|
+ // end::indices-put-settings-request-preserveExisting
|
|
|
+ // tag::indices-put-settings-request-timeout
|
|
|
request.timeout(TimeValue.timeValueMinutes(2)); // <1>
|
|
|
request.timeout("2m"); // <2>
|
|
|
- // end::put-settings-request-timeout
|
|
|
- // tag::put-settings-request-masterTimeout
|
|
|
+ // end::indices-put-settings-request-timeout
|
|
|
+ // tag::indices-put-settings-request-masterTimeout
|
|
|
request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); // <1>
|
|
|
request.masterNodeTimeout("1m"); // <2>
|
|
|
- // end::put-settings-request-masterTimeout
|
|
|
- // tag::put-settings-request-indicesOptions
|
|
|
+ // end::indices-put-settings-request-masterTimeout
|
|
|
+ // tag::indices-put-settings-request-indicesOptions
|
|
|
request.indicesOptions(IndicesOptions.lenientExpandOpen()); // <1>
|
|
|
- // end::put-settings-request-indicesOptions
|
|
|
+ // end::indices-put-settings-request-indicesOptions
|
|
|
|
|
|
- // tag::put-settings-execute
|
|
|
+ // tag::indices-put-settings-execute
|
|
|
AcknowledgedResponse updateSettingsResponse =
|
|
|
client.indices().putSettings(request, RequestOptions.DEFAULT);
|
|
|
- // end::put-settings-execute
|
|
|
+ // end::indices-put-settings-execute
|
|
|
|
|
|
- // tag::put-settings-response
|
|
|
+ // tag::indices-put-settings-response
|
|
|
boolean acknowledged = updateSettingsResponse.isAcknowledged(); // <1>
|
|
|
- // end::put-settings-response
|
|
|
+ // end::indices-put-settings-response
|
|
|
assertTrue(acknowledged);
|
|
|
|
|
|
- // tag::put-settings-execute-listener
|
|
|
+ // tag::indices-put-settings-execute-listener
|
|
|
ActionListener<AcknowledgedResponse> listener =
|
|
|
new ActionListener<AcknowledgedResponse>() {
|
|
|
|
|
@@ -2084,15 +2084,15 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
// <2>
|
|
|
}
|
|
|
};
|
|
|
- // end::put-settings-execute-listener
|
|
|
+ // end::indices-put-settings-execute-listener
|
|
|
|
|
|
// Replace the empty listener by a blocking listener in test
|
|
|
final CountDownLatch latch = new CountDownLatch(1);
|
|
|
listener = new LatchedActionListener<>(listener, latch);
|
|
|
|
|
|
- // tag::put-settings-execute-async
|
|
|
+ // tag::indices-put-settings-execute-async
|
|
|
client.indices().putSettingsAsync(request, RequestOptions.DEFAULT, listener); // <1>
|
|
|
- // end::put-settings-execute-async
|
|
|
+ // end::indices-put-settings-execute-async
|
|
|
|
|
|
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
|
|
}
|
|
@@ -2332,35 +2332,35 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
String index = "some_index";
|
|
|
createIndex(index, Settings.EMPTY);
|
|
|
|
|
|
- // tag::validate-query-request
|
|
|
+ // tag::indices-validate-query-request
|
|
|
ValidateQueryRequest request = new ValidateQueryRequest(index); // <1>
|
|
|
- // end::validate-query-request
|
|
|
+ // end::indices-validate-query-request
|
|
|
|
|
|
- // tag::validate-query-request-query
|
|
|
+ // tag::indices-validate-query-request-query
|
|
|
QueryBuilder builder = QueryBuilders
|
|
|
.boolQuery() // <1>
|
|
|
.must(QueryBuilders.queryStringQuery("*:*"))
|
|
|
.filter(QueryBuilders.termQuery("user", "kimchy"));
|
|
|
request.query(builder); // <2>
|
|
|
- // end::validate-query-request-query
|
|
|
+ // end::indices-validate-query-request-query
|
|
|
|
|
|
- // tag::validate-query-request-explain
|
|
|
+ // tag::indices-validate-query-request-explain
|
|
|
request.explain(true); // <1>
|
|
|
- // end::validate-query-request-explain
|
|
|
+ // end::indices-validate-query-request-explain
|
|
|
|
|
|
- // tag::validate-query-request-allShards
|
|
|
+ // tag::indices-validate-query-request-allShards
|
|
|
request.allShards(true); // <1>
|
|
|
- // end::validate-query-request-allShards
|
|
|
+ // end::indices-validate-query-request-allShards
|
|
|
|
|
|
- // tag::validate-query-request-rewrite
|
|
|
+ // tag::indices-validate-query-request-rewrite
|
|
|
request.rewrite(true); // <1>
|
|
|
- // end::validate-query-request-rewrite
|
|
|
+ // end::indices-validate-query-request-rewrite
|
|
|
|
|
|
- // tag::validate-query-execute
|
|
|
+ // tag::indices-validate-query-execute
|
|
|
ValidateQueryResponse response = client.indices().validateQuery(request, RequestOptions.DEFAULT); // <1>
|
|
|
- // end::validate-query-execute
|
|
|
+ // end::indices-validate-query-execute
|
|
|
|
|
|
- // tag::validate-query-response
|
|
|
+ // tag::indices-validate-query-response
|
|
|
boolean isValid = response.isValid(); // <1>
|
|
|
int totalShards = response.getTotalShards(); // <2>
|
|
|
int successfulShards = response.getSuccessfulShards(); // <3>
|
|
@@ -2377,9 +2377,9 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
int shardId = explanation.getShard(); // <11>
|
|
|
String explanationString = explanation.getExplanation(); // <12>
|
|
|
}
|
|
|
- // end::validate-query-response
|
|
|
+ // end::indices-validate-query-response
|
|
|
|
|
|
- // tag::validate-query-execute-listener
|
|
|
+ // tag::indices-validate-query-execute-listener
|
|
|
ActionListener<ValidateQueryResponse> listener =
|
|
|
new ActionListener<ValidateQueryResponse>() {
|
|
|
@Override
|
|
@@ -2392,15 +2392,15 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
// <2>
|
|
|
}
|
|
|
};
|
|
|
- // end::validate-query-execute-listener
|
|
|
+ // end::indices-validate-query-execute-listener
|
|
|
|
|
|
// Replace the empty listener by a blocking listener in test
|
|
|
final CountDownLatch latch = new CountDownLatch(1);
|
|
|
listener = new LatchedActionListener<>(listener, latch);
|
|
|
|
|
|
- // tag::validate-query-execute-async
|
|
|
+ // tag::indices-validate-query-execute-async
|
|
|
client.indices().validateQueryAsync(request, RequestOptions.DEFAULT, listener); // <1>
|
|
|
- // end::validate-query-execute-async
|
|
|
+ // end::indices-validate-query-execute-async
|
|
|
|
|
|
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
|
|
}
|
|
@@ -2444,9 +2444,9 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
request.attributes("keyword", "type"); // <2>
|
|
|
// end::analyze-request-explain
|
|
|
|
|
|
- // tag::analyze-request-sync
|
|
|
+ // tag::analyze-execute
|
|
|
AnalyzeResponse response = client.indices().analyze(request, RequestOptions.DEFAULT);
|
|
|
- // end::analyze-request-sync
|
|
|
+ // end::analyze-execute
|
|
|
|
|
|
// tag::analyze-response-tokens
|
|
|
List<AnalyzeResponse.AnalyzeToken> tokens = response.getTokens(); // <1>
|
|
@@ -2482,12 +2482,12 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
ActionListener<AnalyzeResponse> listener = new ActionListener<AnalyzeResponse>() {
|
|
|
@Override
|
|
|
public void onResponse(AnalyzeResponse analyzeTokens) {
|
|
|
-
|
|
|
+ // <1>
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onFailure(Exception e) {
|
|
|
-
|
|
|
+ // <2>
|
|
|
}
|
|
|
};
|
|
|
// end::analyze-execute-listener
|
|
@@ -2501,9 +2501,9 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase
|
|
|
final CountDownLatch latch = new CountDownLatch(1);
|
|
|
listener = new LatchedActionListener<>(listener, latch);
|
|
|
|
|
|
- // tag::analyze-request-async
|
|
|
- client.indices().analyzeAsync(request, RequestOptions.DEFAULT, listener);
|
|
|
- // end::analyze-request-async
|
|
|
+ // tag::analyze-execute-async
|
|
|
+ client.indices().analyzeAsync(request, RequestOptions.DEFAULT, listener); // <1>
|
|
|
+ // end::analyze-execute-async
|
|
|
|
|
|
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
|
|
}
|