Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into mt/impl-37340
Browse files Browse the repository at this point in the history
  • Loading branch information
matriv committed Jan 23, 2019
2 parents 6bcc0af + 6a5d9d9 commit 89ed0ba
Show file tree
Hide file tree
Showing 476 changed files with 6,647 additions and 7,261 deletions.
10 changes: 10 additions & 0 deletions TESTING.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -631,3 +631,13 @@ inside `/etc/hosts`, e.g.:
255.255.255.255 broadcasthost
::1 localhost ElasticMBP.local`
....

== Benchmarking

For changes that might affect the performance characteristics of Elasticsearch
you should also run macrobenchmarks. We maintain a macrobenchmarking tool
called https://github.com/elastic/rally[Rally]
which you can use to measure the performance impact. It comes with a set of
default benchmarks that we also
https://elasticsearch-benchmarks.elastic.co/[run every night]. To get started,
please see https://esrally.readthedocs.io/en/stable/[Rally's documentation].
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ public TemporalAccessor parseJodaDate() {
return jodaFormatter.parse("1234567890");
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class BuildPlugin implements Plugin<Project> {
static void requireJavaHome(Task task, int version) {
Project rootProject = task.project.rootProject // use root project for global accounting
if (rootProject.hasProperty('requiredJavaVersions') == false) {
rootProject.rootProject.ext.requiredJavaVersions = [:].withDefault{key -> return []}
rootProject.rootProject.ext.requiredJavaVersions = [:]
rootProject.gradle.taskGraph.whenReady { TaskExecutionGraph taskGraph ->
List<String> messages = []
for (entry in rootProject.requiredJavaVersions) {
Expand All @@ -415,7 +415,7 @@ class BuildPlugin implements Plugin<Project> {
throw new GradleException("JAVA${version}_HOME required to run task:\n${task}")
}
} else {
rootProject.requiredJavaVersions.get(version).add(task)
rootProject.requiredJavaVersions.getOrDefault(version, []).add(task)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void apply(Project project) {
if (dockerComposeSupported(project) == false) {
project.getLogger().warn(
"Tests for {} require docker-compose at /usr/local/bin/docker-compose or /usr/bin/docker-compose " +
"but none could not be found so these will be skipped", project.getPath()
"but none could be found so these will be skipped", project.getPath()
);
tasks.withType(getTaskClass("com.carrotsearch.gradle.junit4.RandomizedTestingTask"), task ->
task.setEnabled(false)
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/version.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
elasticsearch = 7.0.0
lucene = 8.0.0-snapshot-a1c6e642aa
lucene = 8.0.0-snapshot-83f9835

# optional dependencies
spatial4j = 0.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ public void testIndexPutSettings() throws IOException {
createIndex(index, Settings.EMPTY);

assertThat(dynamicSetting.getDefault(Settings.EMPTY), not(dynamicSettingValue));
UpdateSettingsRequest dynamicSettingRequest = new UpdateSettingsRequest();
UpdateSettingsRequest dynamicSettingRequest = new UpdateSettingsRequest(index);
dynamicSettingRequest.settings(Settings.builder().put(dynamicSettingKey, dynamicSettingValue).build());
AcknowledgedResponse response = execute(dynamicSettingRequest, highLevelClient().indices()::putSettings,
highLevelClient().indices()::putSettingsAsync);
Expand All @@ -1187,7 +1187,7 @@ public void testIndexPutSettings() throws IOException {
assertThat(indexSettingsAsMap.get(dynamicSettingKey), equalTo(String.valueOf(dynamicSettingValue)));

assertThat(staticSetting.getDefault(Settings.EMPTY), not(staticSettingValue));
UpdateSettingsRequest staticSettingRequest = new UpdateSettingsRequest();
UpdateSettingsRequest staticSettingRequest = new UpdateSettingsRequest(index);
staticSettingRequest.settings(Settings.builder().put(staticSettingKey, staticSettingValue).build());
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> execute(staticSettingRequest,
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync));
Expand All @@ -1207,7 +1207,7 @@ public void testIndexPutSettings() throws IOException {
assertThat(indexSettingsAsMap.get(staticSettingKey), equalTo(staticSettingValue));

assertThat(unmodifiableSetting.getDefault(Settings.EMPTY), not(unmodifiableSettingValue));
UpdateSettingsRequest unmodifiableSettingRequest = new UpdateSettingsRequest();
UpdateSettingsRequest unmodifiableSettingRequest = new UpdateSettingsRequest(index);
unmodifiableSettingRequest.settings(Settings.builder().put(unmodifiableSettingKey, unmodifiableSettingValue).build());
exception = expectThrows(ElasticsearchException.class, () -> execute(unmodifiableSettingRequest,
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,22 @@ public void onFailure(Exception e) {
public void testGetFollowStats() throws Exception {
RestHighLevelClient client = highLevelClient();

{
// Create leader index:
CreateIndexRequest createIndexRequest = new CreateIndexRequest("leader");
createIndexRequest.settings(Collections.singletonMap("index.soft_deletes.enabled", true));
CreateIndexResponse response = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
assertThat(response.isAcknowledged(), is(true));
}
{
// Follow index, so that we can query for follow stats:
PutFollowRequest putFollowRequest = new PutFollowRequest("local", "leader", "follower");
PutFollowResponse putFollowResponse = client.ccr().putFollow(putFollowRequest, RequestOptions.DEFAULT);
assertThat(putFollowResponse.isFollowIndexCreated(), is(true));
assertThat(putFollowResponse.isFollowIndexShardsAcked(), is(true));
assertThat(putFollowResponse.isIndexFollowingStarted(), is(true));
}

// tag::ccr-get-follow-stats-request
FollowStatsRequest request =
new FollowStatsRequest("follower"); // <1>
Expand Down Expand Up @@ -671,6 +687,12 @@ public void onFailure(Exception e) {
// end::ccr-get-follow-stats-execute-async

assertTrue(latch.await(30L, TimeUnit.SECONDS));

{
PauseFollowRequest pauseFollowRequest = new PauseFollowRequest("follower");
AcknowledgedResponse pauseFollowResponse = client.ccr().pauseFollow(pauseFollowRequest, RequestOptions.DEFAULT);
assertThat(pauseFollowResponse.isAcknowledged(), is(true));
}
}

static Map<String, Object> toMap(Response response) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@

package org.elasticsearch.client.indices;

import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.RandomCreateIndexGenerator;
import org.elasticsearch.test.AbstractXContentTestCase;

import java.io.IOException;
import java.util.Map;

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37654")
public class PutMappingRequestTests extends AbstractXContentTestCase<PutMappingRequest> {

@Override
Expand All @@ -47,7 +46,10 @@ protected PutMappingRequest createTestInstance() {
@Override
protected PutMappingRequest doParseInstance(XContentParser parser) throws IOException {
PutMappingRequest request = new PutMappingRequest();
request.source(parser.map());
Map<String, Object> map = parser.map();
if (map.isEmpty() == false) {
request.source(map);
}
return request;
}

Expand All @@ -58,11 +60,16 @@ protected boolean supportsUnknownFields() {

@Override
protected void assertEqualInstances(PutMappingRequest expected, PutMappingRequest actual) {
try (XContentParser expectedJson = createParser(expected.xContentType().xContent(), expected.source());
XContentParser actualJson = createParser(actual.xContentType().xContent(), actual.source())) {
assertEquals(expectedJson.mapOrdered(), actualJson.mapOrdered());
} catch (IOException e) {
throw new RuntimeException(e);
if (actual.source() != null) {
try (XContentParser expectedJson = createParser(expected.xContentType().xContent(), expected.source());
XContentParser actualJson = createParser(actual.xContentType().xContent(), actual.source())) {
assertEquals(expectedJson.mapOrdered(), actualJson.mapOrdered());
} catch (IOException e) {
throw new RuntimeException(e);
}
} else {
// if the original `source` is null, the parsed source should be so too
assertNull(expected.source());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public HttpEntity getEntity() {
private static final Pattern WARNING_HEADER_PATTERN = Pattern.compile(
"299 " + // warn code
"Elasticsearch-\\d+\\.\\d+\\.\\d+(?:-(?:alpha|beta|rc)\\d+)?(?:-SNAPSHOT)?-(?:[a-f0-9]{7}|Unknown) " + // warn agent
"\"((?:\t| |!|[\\x23-\\x5B]|[\\x5D-\\x7E]|[\\x80-\\xFF]|\\\\|\\\\\")*)\" " + // quoted warning value, captured
"\"((?:\t| |!|[\\x23-\\x5B]|[\\x5D-\\x7E]|[\\x80-\\xFF]|\\\\|\\\\\")*)\"( " + // quoted warning value, captured
// quoted RFC 1123 date format
"\"" + // opening quote
"(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), " + // weekday
Expand All @@ -112,7 +112,7 @@ public HttpEntity getEntity() {
"\\d{4} " + // 4-digit year
"\\d{2}:\\d{2}:\\d{2} " + // (two-digit hour):(two-digit minute):(two-digit second)
"GMT" + // GMT
"\""); // closing quote
"\")?"); // closing quote (optional, since an older version can still send a warn-date)

/**
* Returns a list of all warning headers returned in the response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Example:

[source,js]
--------------------------------------------------
PUT /emails/_doc/_bulk?refresh
PUT /emails/_bulk?refresh
{ "index" : { "_id" : 1 } }
{ "accounts" : ["hillary", "sidney"]}
{ "index" : { "_id" : 2 } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Example:

[source,js]
--------------------------------------------------
PUT /logs/_doc/_bulk?refresh
PUT /logs/_bulk?refresh
{ "index" : { "_id" : 1 } }
{ "body" : "warning: page could not be rendered" }
{ "index" : { "_id" : 2 } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ Example:

[source,js]
--------------------------------------------------
PUT /museums?include_type_name=true
PUT /museums
{
"mappings": {
"_doc": {
"properties": {
"location": {
"type": "geo_point"
}
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
POST /museums/_doc/_bulk?refresh
POST /museums/_bulk?refresh
{"index":{"_id":1}}
{"location": "52.374081,4.912350", "city": "Amsterdam", "name": "NEMO Science Museum"}
{"index":{"_id":2}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Imagine a situation where you index the following documents into an index with 2

[source,js]
--------------------------------------------------
PUT /transactions/_doc/_bulk?refresh
PUT /transactions/_bulk?refresh
{"index":{"_id":1}}
{"type": "sale","amount": 80}
{"index":{"_id":2}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The top_hits aggregation returns regular search hits, because of this many per h
* <<search-request-script-fields,Script fields>>
* <<search-request-docvalue-fields,Doc value fields>>
* <<search-request-version,Include versions>>
* <<search-request-seq-no-primary-term,Include Sequence Numbers and Primary Terms>>

==== Example

Expand Down
20 changes: 9 additions & 11 deletions docs/reference/analysis/analyzers/configuring.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ to support a list of stop words:

[source,js]
--------------------------------
PUT my_index?include_type_name=true
PUT my_index
{
"settings": {
"analysis": {
Expand All @@ -21,16 +21,14 @@ PUT my_index?include_type_name=true
}
},
"mappings": {
"_doc": {
"properties": {
"my_text": {
"type": "text",
"analyzer": "standard", <2>
"fields": {
"english": {
"type": "text",
"analyzer": "std_english" <3>
}
"properties": {
"my_text": {
"type": "text",
"analyzer": "standard", <2>
"fields": {
"english": {
"type": "text",
"analyzer": "std_english" <3>
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ replace any embedded dashes in numbers with underscores, i.e `123-456-789` ->

[source,js]
----------------------------
PUT my_index?include_type_name=true
PUT my_index
{
"settings": {
"analysis": {
Expand Down Expand Up @@ -100,7 +100,7 @@ camelCase words to be queried individually:

[source,js]
----------------------------
PUT my_index?include_type_name=true
PUT my_index
{
"settings": {
"analysis": {
Expand All @@ -125,12 +125,10 @@ PUT my_index?include_type_name=true
}
},
"mappings": {
"_doc": {
"properties": {
"text": {
"type": "text",
"analyzer": "my_analyzer"
}
"properties": {
"text": {
"type": "text",
"analyzer": "my_analyzer"
}
}
}
Expand Down
16 changes: 7 additions & 9 deletions docs/reference/analysis/tokenizers/edgengram-tokenizer.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ length `10`:

[source,js]
----------------------------
PUT my_index?include_type_name=true
PUT my_index
{
"settings": {
"analysis": {
Expand Down Expand Up @@ -222,7 +222,7 @@ Below is an example of how to set up a field for _search-as-you-type_:

[source,js]
-----------------------------------
PUT my_index?include_type_name=true
PUT my_index
{
"settings": {
"analysis": {
Expand Down Expand Up @@ -250,13 +250,11 @@ PUT my_index?include_type_name=true
}
},
"mappings": {
"_doc": {
"properties": {
"title": {
"type": "text",
"analyzer": "autocomplete",
"search_analyzer": "autocomplete_search"
}
"properties": {
"title": {
"type": "text",
"analyzer": "autocomplete",
"search_analyzer": "autocomplete_search"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions docs/reference/api-conventions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ Where:
`date_format`:: is the optional format in which the computed date should be rendered. Defaults to `YYYY.MM.dd`.
`time_zone`:: is the optional time zone . Defaults to `utc`.

Date math expressions are resolved locale-independent. Consequently, it is not possible to use any other
calendars than the Gregorian calendar.

You must enclose date math index name expressions within angle brackets, and
all special characters should be URI encoded. For example:

Expand Down
Loading

0 comments on commit 89ed0ba

Please sign in to comment.