Authored by unknown

consumer适配到5.4.3

... ... @@ -36,7 +36,7 @@
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.3.4</version>
<version>5.4.3</version>
</dependency>
</dependencies>
</project>
... ...
package com.yoho.search.consumer.index.agg;
import com.yoho.search.consumer.suggests.common.SuggestionConstants;
import com.yoho.search.core.es.agg.AbstractAggregation;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation.Bucket;
import org.elasticsearch.search.aggregations.bucket.terms.support.IncludeExclude;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import com.yoho.search.consumer.suggests.common.SuggestionConstants;
import com.yoho.search.core.es.agg.AbstractAggregation;
public abstract class AbstractTokenAggregation extends AbstractAggregation {
... ... @@ -29,8 +31,8 @@ public abstract class AbstractTokenAggregation extends AbstractAggregation {
}
@Override
public AbstractAggregationBuilder getBuilder() {
return AggregationBuilders.terms(aggName()).field(fieldName()).size(size).minDocCount(minDocCount).include(".{2,15}");
public AbstractAggregationBuilder<?> getBuilder() {
return AggregationBuilders.terms(aggName()).field(fieldName()).size(size).minDocCount(minDocCount).includeExclude(new IncludeExclude(".{2,15}", null));
}
@Override
... ...
... ... @@ -187,7 +187,7 @@ public class YohoIndexServiceImpl implements IYohoIndexService, ApplicationEvent
Map<String,Object> indexSettings = new HashMap<String,Object>();
indexSettings.putAll(properties);
indexSettings.put("max_result_window", "100000000");
//indexSettings.putAll(this.analysisConfigMap);回退分词器设置,以定位主节点带宽过高的问题
indexSettings.putAll(this.analysisConfigMap);//回退分词器设置,以定位主节点带宽过高的问题
client.createIndex(newRealIndexName, yohoIndexName, indexSettings, mappingContent);
// 5、删除旧索引别名
if (oldRealIndexNames != null && !oldRealIndexNames.isEmpty()) {
... ...
package com.yoho.search.consumer.suggests.common;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.MultiMatchQueryBuilder;
import org.elasticsearch.index.query.Operator;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.consumer.suggests.counter.CountUsage;
import com.yoho.search.core.es.model.SearchParam;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.index.query.*;
import java.util.List;
/**
* Created by ginozhang on 2017/1/3.
... ... @@ -74,10 +79,10 @@ public final class SuggestSearchParamBuilder {
setDefaultSearchField(queryBuilder);
if (ISearchConstants.SEARCH_OPERATOR.equalsIgnoreCase("or")) {
queryBuilder.operator(MatchQueryBuilder.Operator.OR);
queryBuilder.operator(Operator.OR);
queryBuilder.minimumShouldMatch(ISearchConstants.SEARCH_MINIMUM_SHOULD_MATCH);
} else {
queryBuilder.operator(MatchQueryBuilder.Operator.AND);
queryBuilder.operator(Operator.AND);
}
return queryBuilder;
}
... ...