Skip to content

Commit

Permalink
Merge remote-tracking branch 'es/6.x' into ccr-6.x
Browse files Browse the repository at this point in the history
* es/6.x:
  Fix compil after backport
  Fix index prefixes to work with span_multi (#31066)
  Delete superfluous UpdateRequest test
  Disable MultiMatchQueryBuilderTests.
  Disable UpdateRequestTest#testUnknownFieldParsing.
  Update get.asciidoc (#31084)
  When the 'strict' mapping option is enabled, make sure to validate split_queries_on_whitespace.
  Transport client: Don't validate node in handshake (#30737) (#31080)
  In the internal highlighter APIs, use the field type as opposed to the mapper. (#31039)
  [DOCS] Removes redundant authorization pages
  Upgrade to Lucene-7.4.0-snapshot-0a7c3f462f (#31073)
  • Loading branch information
martijnvg committed Jun 5, 2018
2 parents d125719 + 86e5f00 commit 51963e5
Show file tree
Hide file tree
Showing 78 changed files with 491 additions and 571 deletions.
2 changes: 1 addition & 1 deletion buildSrc/version.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
elasticsearch = 6.4.0
lucene = 7.4.0-snapshot-1cbadda4d3
lucene = 7.4.0-snapshot-0a7c3f462f

# optional dependencies
spatial4j = 0.7
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/docs/get.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ The result of the above get operation is:
// TESTRESPONSE


Field values fetched from the document it self are always returned as an array.
Field values fetched from the document itself are always returned as an array.
Since the `counter` field is not stored the get request simply ignores it when trying to get the `stored_fields.`

It is also possible to retrieve metadata fields like the `_routing` field:
Expand Down
8 changes: 8 additions & 0 deletions docs/reference/query-dsl/span-multi-term-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ GET /_search
}
--------------------------------------------------
// CONSOLE

WARNING: By default `span_multi queries are rewritten to a `span_or` query
containing **all** the expanded terms. This can be expensive if the number of expanded
terms is large. To avoid an unbounded expansion you can set the
<<query-dsl-multi-term-rewrite,rewrite method>> of the multi term query to `top_terms_*`
rewrite. Or, if you use `span_multi` on `prefix` query only, you can
activate the <<index-prefix-config,`index_prefixes`>> field option of the `text` field instead. This will
rewrite any prefix query on the field to a a single term query that matches the indexed prefix.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bf2cfa0551ebdf08a2cf3079f3c74643bd9dbb76

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
82d83fcac1d9c8948aa0247fc9c87f177ddbd59b

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
73fd4364f2931e7c8303b5927e140a7d21116c36

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0a2c4417fa9a8be078864f590a5a66b98d551cf5

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6fa179924f139a30fc0e5399256e1a44562ed32b

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5ed135d34d7868b71a725257a46dc8d8735a15d4

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
875911b36b99c2103719f94559878a0ecb862fb6

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e7191628df8cb72382a20da79224aef677117849

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"search with index prefixes":
setup:
- skip:
version: " - 6.99.99"
version: " - 6.2.99"
reason: index_prefixes is only available as of 6.3.0

- do:
indices.create:
index: test
Expand All @@ -27,6 +27,11 @@
indices.refresh:
index: [test]

---
"search with index prefixes":
- skip:
version: " - 6.2.99"
reason: index_prefixes is only available as of 6.3.0
- do:
search:
index: test
Expand Down Expand Up @@ -57,3 +62,23 @@

- match: {hits.total: 1}
- match: {hits.hits.0._score: 1}

---
"search index prefixes with span_multi":
- skip:
version: " - 6.2.99"
reason: span_multi throws an exception with prefix fields on < versions

- do:
search:
index: test
body:
query:
span_near:
clauses: [
{ "span_term": { "text": "short" } },
{ "span_multi": { "match": { "prefix": { "text": "word" } } } }
]

- match: {hits.total: 1}

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8cd761f40c4a89ed977167f0518d12e409eaf3d8

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8c93ed67599d345b9359586248ab92342d7d3033

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
003ed080e5184661e606091cd321c229798b22f8

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0b4be9f96edfd3dbcff5aa9b3f0914e86eb9cc51

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a5dcceb5bc017cee6ab5d3ee1943aca1ac6fe074

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b59e7441f121da969bef8eef2c0c61743b4230a8

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
46736dbb07b432f0a7c1b3080f62932c483e5cb9

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ee203718d525da0c6258a51a5a32d877089fe5af

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cf17a332d8e42a45e8f013d5df408f4391d2620a

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
04832303d70502d2ece44501cb1716f42e24fe35

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
639313e3a9573779b6a28b45a7f57fc1f73ffa46

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6144b493ba3588a638858d0058054758acc619b9

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9d00c6b8bbbbb496aecd555406267fee9e0af914

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
159cdb6d36845690cb1972d02cc0b472bb14b7f3

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
af1dd0218d58990cca5c1592d9722e67d233c996

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import com.carrotsearch.hppc.cursors.ObjectCursor;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.apache.logging.log4j.util.Supplier;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.core.internal.io.IOUtils;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.Version;
Expand Down Expand Up @@ -56,6 +56,7 @@
import org.elasticsearch.transport.TransportService;

import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
Expand Down Expand Up @@ -89,6 +90,7 @@ final class TransportClientNodesService extends AbstractComponent implements Clo
private final Object mutex = new Object();

private volatile List<DiscoveryNode> nodes = Collections.emptyList();
// Filtered nodes are nodes whose cluster name does not match the configured cluster name
private volatile List<DiscoveryNode> filteredNodes = Collections.emptyList();

private final AtomicInteger tempNodeIdGenerator = new AtomicInteger();
Expand Down Expand Up @@ -268,7 +270,7 @@ public static class RetryListener<Response> implements ActionListener<Response>
private volatile int i;

RetryListener(NodeListenerCallback<Response> callback, ActionListener<Response> listener,
List<DiscoveryNode> nodes, int index, TransportClient.HostFailureListener hostFailureListener) {
List<DiscoveryNode> nodes, int index, TransportClient.HostFailureListener hostFailureListener) {
this.callback = callback;
this.listener = listener;
this.nodes = nodes;
Expand Down Expand Up @@ -361,10 +363,10 @@ public void sample() {
protected abstract void doSample();

/**
* validates a set of potentially newly discovered nodes and returns an immutable
* list of the nodes that has passed.
* Establishes the node connections. If validateInHandshake is set to true, the connection will fail if
* node returned in the handshake response is different than the discovery node.
*/
protected List<DiscoveryNode> validateNewNodes(Set<DiscoveryNode> nodes) {
List<DiscoveryNode> establishNodeConnections(Set<DiscoveryNode> nodes) {
for (Iterator<DiscoveryNode> it = nodes.iterator(); it.hasNext(); ) {
DiscoveryNode node = it.next();
if (!transportService.nodeConnected(node)) {
Expand All @@ -380,7 +382,6 @@ protected List<DiscoveryNode> validateNewNodes(Set<DiscoveryNode> nodes) {

return Collections.unmodifiableList(new ArrayList<>(nodes));
}

}

class ScheduledNodeSampler implements Runnable {
Expand All @@ -402,14 +403,16 @@ class SimpleNodeSampler extends NodeSampler {
@Override
protected void doSample() {
HashSet<DiscoveryNode> newNodes = new HashSet<>();
HashSet<DiscoveryNode> newFilteredNodes = new HashSet<>();
ArrayList<DiscoveryNode> newFilteredNodes = new ArrayList<>();
for (DiscoveryNode listedNode : listedNodes) {
try (Transport.Connection connection = transportService.openConnection(listedNode, LISTED_NODES_PROFILE)){
final PlainTransportFuture<LivenessResponse> handler = new PlainTransportFuture<>(
new FutureTransportResponseHandler<LivenessResponse>() {
@Override
public LivenessResponse newInstance() {
return new LivenessResponse();
public LivenessResponse read(StreamInput in) throws IOException {
LivenessResponse response = new LivenessResponse();
response.readFrom(in);
return response;
}
});
transportService.sendRequest(connection, TransportLivenessAction.NAME, new LivenessRequest(),
Expand All @@ -435,8 +438,8 @@ public LivenessResponse newInstance() {
}
}

nodes = validateNewNodes(newNodes);
filteredNodes = Collections.unmodifiableList(new ArrayList<>(newFilteredNodes));
nodes = establishNodeConnections(newNodes);
filteredNodes = Collections.unmodifiableList(newFilteredNodes);
}
}

Expand Down Expand Up @@ -557,7 +560,7 @@ public void handleException(TransportException e) {
}
}

nodes = validateNewNodes(newNodes);
nodes = establishNodeConnections(newNodes);
filteredNodes = Collections.unmodifiableList(new ArrayList<>(newFilteredNodes));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.Version;
import org.elasticsearch.index.fielddata.AbstractSortedDocValues;
import org.elasticsearch.index.fielddata.AbstractSortedSetDocValues;
import org.elasticsearch.index.mapper.IdFieldMapper;
import org.elasticsearch.index.mapper.ParentFieldMapper;
import org.elasticsearch.index.mapper.RoutingFieldMapper;
Expand All @@ -58,16 +57,16 @@ final class TranslogLeafReader extends LeafReader {
private final Translog.Index operation;
private static final FieldInfo FAKE_SOURCE_FIELD
= new FieldInfo(SourceFieldMapper.NAME, 1, false, false, false, IndexOptions.NONE, DocValuesType.NONE, -1, Collections.emptyMap(),
0,0);
0, 0, false);
private static final FieldInfo FAKE_ROUTING_FIELD
= new FieldInfo(RoutingFieldMapper.NAME, 2, false, false, false, IndexOptions.NONE, DocValuesType.NONE, -1, Collections.emptyMap(),
0,0);
0, 0, false);
private static final FieldInfo FAKE_ID_FIELD
= new FieldInfo(IdFieldMapper.NAME, 3, false, false, false, IndexOptions.NONE, DocValuesType.NONE, -1, Collections.emptyMap(),
0,0);
0, 0, false);
private static final FieldInfo FAKE_UID_FIELD
= new FieldInfo(UidFieldMapper.NAME, 4, false, false, false, IndexOptions.NONE, DocValuesType.NONE, -1, Collections.emptyMap(),
0,0);
0, 0, false);
private final Version indexVersionCreated;

TranslogLeafReader(Translog.Index operation, Version indexVersionCreated) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ public void checkCompatibility(MappedFieldType otherFT, List<String> conflicts,
if (Objects.equals(normalizer, other.normalizer) == false) {
conflicts.add("mapper [" + name() + "] has different [normalizer]");
}
if (strict) {
if (splitQueriesOnWhitespace != other.splitQueriesOnWhitespace) {
conflicts.add("mapper [" + name() + "] is used by multiple types. Set update_all_types" +
" to true to update [split_queries_on_whitespace] across all types.");
}
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.lucene.search.PhraseQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.elasticsearch.Version;
import org.elasticsearch.common.collect.Iterators;
import org.elasticsearch.common.logging.ESLoggerFactory;
import org.elasticsearch.common.settings.Settings;
Expand Down Expand Up @@ -176,7 +177,16 @@ public TextFieldMapper build(BuilderContext context) {
if (fieldType().isSearchable() == false) {
throw new IllegalArgumentException("Cannot set index_prefixes on unindexed field [" + name() + "]");
}
if (fieldType.indexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) {
// Copy the index options of the main field to allow phrase queries on
// the prefix field.
if (context.indexCreatedVersion().onOrAfter(Version.V_6_4_0)) {
if (fieldType.indexOptions() == IndexOptions.DOCS_AND_FREQS) {
// frequencies are not needed because prefix queries always use a constant score
prefixFieldType.setIndexOptions(IndexOptions.DOCS);
} else {
prefixFieldType.setIndexOptions(fieldType.indexOptions());
}
} else if (fieldType.indexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) {
prefixFieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
}
if (fieldType.storeTermVectorOffsets()) {
Expand Down
Loading

0 comments on commit 51963e5

Please sign in to comment.