Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to 5.0.0-alpha4 #1

Merged
merged 1 commit into from
Jul 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

buildscript {
repositories {
mavenCentral()
maven {
name 'sonatype-snapshots'
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
jcenter()
}
dependencies {
// Version of elasticsearch
classpath "org.elasticsearch.gradle:build-tools:5.0.0-alpha4"
}
}

apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'elasticsearch.esplugin'
apply plugin: 'com.bmuschko.nexus'

// Version of the plugin
version = '5.0.0-SNAPSHOT'

esplugin {
description 'Experimental plugin for access to low level index properties of documents.'
classname 'org.elasticsearch.plugin.TokenPlugin'
name 'es-token-plugin'
}

ext.compactProfile = 'full'

dependencies {
// Not really used at the moment - just to show how to include dependencies
compile "org.jpmml:pmml-agent:1.2.8"
compile "org.jpmml:pmml-model:1.2.8"
compile "org.jpmml:pmml-schema:1.2.8"
}

test {
systemProperty 'tests.security.manager', 'false'
}

compileJava.options.compilerArgs << "-Xlint:-deprecation"

// TODO: temporary workaround until it's fixed in elasticsearch
thirdPartyAudit.enabled = false

// TODO: it really don't like knime workspace and log files, we might be able to re-enable it after cleanup
forbiddenPatterns.enabled = false

integTest {
cluster {
setting 'script.engine.pmml_model.stored.search', 'true'
}
}
67 changes: 0 additions & 67 deletions pom.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -131,7 +130,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
}

static final class Fields {
static final XContentBuilderString TERMS = new XContentBuilderString("terms");
static final String TERMS = "terms";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ public ActionRequestValidationException validate() {
return null;
}

protected AllTermsShardRequest(AllTermsRequest request, String index, int shardId, String field, int size, String from, long minDocFreq) {
super(request, index);
protected AllTermsShardRequest(AllTermsRequest request, String index, int shardId, String field, int size, String from,
long minDocFreq) {
super(index);
this.shardId = shardId;
this.field = field;
this.size = size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,20 @@
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.routing.GroupShardsIterator;
import org.elasticsearch.cluster.routing.ShardIterator;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.AtomicArray;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;

public class TransportAllTermsAction extends HandledTransportAction<AllTermsRequest, AllTermsResponse> {

Expand All @@ -46,7 +47,8 @@ public class TransportAllTermsAction extends HandledTransportAction<AllTermsRequ
public TransportAllTermsAction(Settings settings, ThreadPool threadPool, TransportService transportService,
ClusterService clusterService, TransportAllTermsShardAction shardAction, ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver) {
super(settings, AllTermsAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, AllTermsRequest.class);
super(settings, AllTermsAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver,
AllTermsRequest::new);
this.clusterService = clusterService;
this.shardAction = shardAction;
}
Expand All @@ -57,11 +59,13 @@ protected void doExecute(final AllTermsRequest request, final ActionListener<All

clusterState.blocks().globalBlockedRaiseException(ClusterBlockLevel.READ);

final GroupShardsIterator groupShardsIterator = clusterService.operationRouting().searchShards(clusterState, request.indices(), null, null);
final GroupShardsIterator groupShardsIterator = clusterService.operationRouting().searchShards(clusterState, request.indices(),
null, null);
final AtomicArray<AllTermsSingleShardResponse> shardResponses = new AtomicArray<>(groupShardsIterator.size());
final AtomicInteger shardCounter = new AtomicInteger(shardResponses.length());
for (final ShardIterator shardIterator : groupShardsIterator) {
final AllTermsShardRequest shardRequest = new AllTermsShardRequest(request, request.indices()[0], shardIterator.shardId().id(), request.field(), request.size(), request.from(), request.minDocFreq());
final AllTermsShardRequest shardRequest = new AllTermsShardRequest(request, request.indices()[0], shardIterator.shardId().id(),
request.field(), request.size(), request.from(), request.minDocFreq());
shardAction.execute(shardRequest, new ActionListener<AllTermsSingleShardResponse>() {
@Override
public void onResponse(AllTermsSingleShardResponse response) {
Expand All @@ -79,7 +83,8 @@ public void onFailure(Throwable e) {
}

public void finish() {
AllTermsResponse response = new AllTermsResponse(shardResponses.toArray(new AllTermsSingleShardResponse[shardResponses.length()]), request.size());
AllTermsResponse response = new AllTermsResponse(shardResponses.toArray(
new AllTermsSingleShardResponse[shardResponses.length()]), request.size());
listener.onResponse(response);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.single.shard.TransportSingleShardAction;
import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.routing.ShardIterator;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.IndexService;
Expand All @@ -43,7 +43,6 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class TransportAllTermsShardAction extends TransportSingleShardAction<AllTermsShardRequest, AllTermsSingleShardResponse> {
Expand All @@ -55,8 +54,10 @@ public class TransportAllTermsShardAction extends TransportSingleShardAction<All

@Inject
public TransportAllTermsShardAction(Settings settings, ClusterService clusterService, TransportService transportService,
IndicesService indicesService, ThreadPool threadPool, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
super(settings, ACTION_NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver, AllTermsShardRequest.class, ThreadPool.Names.GENERIC);
IndicesService indicesService, ThreadPool threadPool, ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver) {
super(settings, ACTION_NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,
AllTermsShardRequest::new, ThreadPool.Names.GENERIC);
this.indicesService = indicesService;
}

Expand Down Expand Up @@ -84,8 +85,8 @@ protected ShardIterator shards(ClusterState state, InternalRequest request) {
@Override
protected AllTermsSingleShardResponse shardOperation(AllTermsShardRequest request, ShardId shardId) throws ElasticsearchException {
List<String> terms = new ArrayList<>();
IndexService indexService = indicesService.indexServiceSafe(request.index());
IndexShard indexShard = indexService.shardSafe(shardId.id());
IndexService indexService = indicesService.indexServiceSafe(shardId.getIndex());
IndexShard indexShard = indexService.getShard(shardId.id());
final Engine.Searcher searcher = indexShard.acquireSearcher("all_terms");
IndexReader topLevelReader = searcher.reader();

Expand Down Expand Up @@ -122,7 +123,8 @@ protected static void getTerms(AllTermsShardRequest request, List<String> terms,
}
}

protected static void findNMoreTerms(AllTermsShardRequest request, List<String> terms, List<TermsEnum> termIters, CharsRefBuilder spare, BytesRef lastTerm, int[] exhausted) {
protected static void findNMoreTerms(AllTermsShardRequest request, List<String> terms, List<TermsEnum> termIters, CharsRefBuilder spare,
BytesRef lastTerm, int[] exhausted) {
if (getDocFreq(termIters, lastTerm, exhausted) >= request.minDocFreq()) {
spare.copyUTF8Bytes(lastTerm);
terms.add(spare.toString());
Expand Down Expand Up @@ -152,7 +154,8 @@ protected static List<TermsEnum> getTermsEnums(AllTermsShardRequest request, Lis
return termIters;
}

protected static BytesRef findSmallestTermAfter(AllTermsShardRequest request, List<TermsEnum> termIters, BytesRef lastTerm, int[] exhausted) throws IOException {
protected static BytesRef findSmallestTermAfter(AllTermsShardRequest request, List<TermsEnum> termIters, BytesRef lastTerm,
int[] exhausted) throws IOException {
for (int i = 0; i < termIters.size(); i++) {
BytesRef curTerm = null;
if (request.from() != null) {
Expand Down
Loading