Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/elasticsearch into remove…
Browse files Browse the repository at this point in the history
…-legacy-role-settings
  • Loading branch information
jasontedor committed Apr 1, 2021
2 parents 541e18d + 370ce5d commit d7299f6
Show file tree
Hide file tree
Showing 26 changed files with 376 additions and 228 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.cli.MockTerminal;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.xcontent.DeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -36,7 +34,6 @@
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;

@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/71145")
@LuceneTestCase.SuppressFileSystems(value = "ExtrasFS") // Don't randomly add 'extra' files to directory.
public class GeoIpCliTests extends LuceneTestCase {

Expand All @@ -45,16 +42,8 @@ public class GeoIpCliTests extends LuceneTestCase {

public void setUp() throws Exception {
super.setUp();
Path tempPath = createTempDir();
source = tempPath.resolve("source");
target = tempPath.resolve("target");
Files.createDirectory(source);
Files.createDirectory(target);
}

@SuppressForbidden(reason = "process builder requires File for directory")
private File getTargetFile() {
return target.toFile();
source = createTempDir();
target = createTempDir();
}

public void testNoSource() throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/mapper-size.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PUT my-index-000001
--------------------------

The value of the `_size` field is accessible in queries, aggregations, scripts,
and when sorting. It can be retrieved using the {ref}/search-fields.html#search-fields-param[fields API]:
and when sorting. It can be retrieved using the {ref}/search-fields.html#search-fields-param[fields parameter]:

[source,console]
--------------------------
Expand Down
16 changes: 9 additions & 7 deletions docs/reference/data-streams/set-up-a-data-stream.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ You can also <<convert-index-alias-to-data-stream,convert an index alias to
a data stream>>.

IMPORTANT: If you use {fleet} or {agent}, skip this tutorial. {fleet} and
{agent} set up data streams for you. See {fleet-guide}/data-streams.html[Data
streams] in the {fleet} Guide.
{agent} set up data streams for you. See {fleet}'s
{fleet-guide}/data-streams.html[data streams] documentation.

[discrete]
[[create-index-lifecycle-policy]]
Expand Down Expand Up @@ -189,11 +189,13 @@ PUT _index_template/my-index-template
[[create-data-stream]]
=== Step 4. Create the data stream

To automatically create the data stream, submit an
<<add-documents-to-a-data-stream,indexing request>> that targets the stream's
name. This name must match one of your index template's index patterns. The
request must use an `op_type` of `create`. Documents must include a `@timestamp`
field.
<<add-documents-to-a-data-stream,Indexing requests>> add documents to a data
stream. These requests must use an `op_type` of `create`. Documents must include
a `@timestamp` field.

To automatically create your data stream, submit an indexing request that
targets the stream's name. This name must match one of your index template's
index patterns.

[source,console]
----
Expand Down
40 changes: 0 additions & 40 deletions docs/reference/tab-widgets/data-tiers-widget.asciidoc

This file was deleted.

93 changes: 0 additions & 93 deletions docs/reference/tab-widgets/data-tiers.asciidoc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,23 @@ public void testNonStringValueWithIgnoreMissing() throws Exception {
}

public void testTargetField() throws Exception {
IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.emptyMap());
String fieldValue = RandomDocumentPicks.randomString(random());
String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, modifyInput(fieldValue));
IngestDocument ingestDocument;
String fieldValue;
String fieldName;
boolean ignoreMissing;
do {
ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.emptyMap());
fieldValue = RandomDocumentPicks.randomString(random());
fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, modifyInput(fieldValue));
ignoreMissing = randomBoolean();
} while (isSupportedValue(ingestDocument.getFieldValue(fieldName, Object.class, ignoreMissing)) == false);
String targetFieldName = fieldName + "foo";
Processor processor = newProcessor(fieldName, randomBoolean(), targetFieldName);
Processor processor = newProcessor(fieldName, ignoreMissing, targetFieldName);
processor.execute(ingestDocument);
assertThat(ingestDocument.getFieldValue(targetFieldName, expectedResultType()), equalTo(expectedResult(fieldValue)));
}

protected boolean isSupportedValue(Object value) {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;

public class URLDecodeProcessorTests extends AbstractStringProcessorTestCase<String> {
@Override
Expand All @@ -30,4 +31,30 @@ protected String expectedResult(String input) {
throw new IllegalArgumentException("invalid");
}
}

@Override
protected boolean isSupportedValue(Object value) {
// some random strings produced by the randomized test framework contain invalid URL encodings
if (value instanceof String) {
return isValidUrlEncodedString((String) value);
} else if (value instanceof List) {
for (Object o : (List) value) {
if ((o instanceof String) == false || isValidUrlEncodedString((String) o) == false) {
return false;
}
}
return true;
} else {
throw new IllegalArgumentException("unexpected type");
}
}

private static boolean isValidUrlEncodedString(String s) {
try {
URLDecoder.decode(s, "UTF-8");
return true;
} catch (Exception e) {
return false;
}
}
}
Loading

0 comments on commit d7299f6

Please sign in to comment.