admin
2020-01-08 16e519c06d0bb3e81db67abcfa97ec08c8a920f8
elasticsearch清理springdata依赖
1 文件已重命名
6个文件已修改
3 文件已复制
2个文件已添加
86 ■■■■■ 已修改文件
fanli/.classpath 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/pom.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/ElasticBaseDao.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/order/ESOrder.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-dev/elasticsearch.properties 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-by/elasticsearch.properties 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro-job/elasticsearch.properties 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-pro/elasticsearch.properties 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/env-sandbox/elasticsearch.properties 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/test/java/org/fanli/elastic/QueryDOUtils.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/src/main/java/org/yeshi/utils/elasticsearch/Document.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/.classpath
@@ -23,6 +23,10 @@
            <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_181"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="target/classes"/>
</classpath>
fanli/pom.xml
@@ -174,6 +174,7 @@
                    <exclude>env-pro/**</exclude>
                    <exclude>env-pro-by/**</exclude>
                    <exclude>env-pro-job/**</exclude>
                     <exclude>env-sandbox/**</exclude>
                </excludes>
            </resource>
            
fanli/src/main/java/com/yeshi/fanli/dao/ElasticBaseDao.java
@@ -14,7 +14,6 @@
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.update.UpdateRequest;
//import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentType;
@@ -22,9 +21,9 @@
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.stereotype.Repository;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.elasticsearch.Document;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
fanli/src/main/java/com/yeshi/fanli/entity/order/ESOrder.java
@@ -1,8 +1,6 @@
package com.yeshi.fanli.entity.order;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.yeshi.utils.elasticsearch.Document;
/**
 * index:是否设置索引, store是否存储数据,type:数据类型,analyzer:分词粒度选择,searchAnalyzer:查询进行分词处理
@@ -10,29 +8,22 @@
 * @author Derlin
 *
 */
@Document(indexName = "order", type = "doc")
@Document(indexName = "order")
public class ESOrder {
    
    // 订单相关uid
    @Field(index=true, store = true, type = FieldType.Long)
    private Long uid;
    // 上级直接uid
    @Field(index=true, store = true, type = FieldType.Long)
    private Long uidDirect;
    // 上 上级直接uid
    @Field(index=true, store = true, type = FieldType.Long)
    private Long uidIndirect;
    // 商品名称
    @Field(index=true, store = true, type = FieldType.Text)
    private String goodsName;
    // 订单号
    @Field(index=true, store = true, type = FieldType.Text)
    private String orderNo;
    // 交易id
    @Field(index=true, store = true, type = FieldType.Text)
    private String tradeId;
    // 交易平台 (1淘宝 2京东  3拼多多)
    @Field(index=true, store = true, type = FieldType.Integer)
    private Integer platform;
    
     
fanli/src/main/resource/env-dev/elasticsearch.properties
New file
@@ -0,0 +1,3 @@
elastic.scheme=http
elastic.port=9200
elastic.host=193.112.34.40
fanli/src/main/resource/env-pro-by/elasticsearch.properties
copy from fanli/src/main/resource/elasticsearch.properties copy to fanli/src/main/resource/env-pro-by/elasticsearch.properties
fanli/src/main/resource/env-pro-job/elasticsearch.properties
copy from fanli/src/main/resource/elasticsearch.properties copy to fanli/src/main/resource/env-pro-job/elasticsearch.properties
fanli/src/main/resource/env-pro/elasticsearch.properties
fanli/src/main/resource/env-sandbox/elasticsearch.properties
copy from fanli/src/main/resource/elasticsearch.properties copy to fanli/src/main/resource/env-sandbox/elasticsearch.properties
fanli/src/test/java/org/fanli/elastic/QueryDOUtils.java
@@ -265,41 +265,6 @@
        }
    }
    public static void MultiTermVectorsRequest() {
        MultiTermVectorsRequest request = new MultiTermVectorsRequest();
        TermVectorsRequest tvrequest1 = new TermVectorsRequest("authors", "1");
        tvrequest1.setFields("user");
        request.add(tvrequest1);
        try {
            XContentBuilder docBuilder = XContentFactory.jsonBuilder();
            docBuilder.startObject().field("user", "guest-user").endObject();
            TermVectorsRequest tvrequest2 = new TermVectorsRequest("authors", docBuilder);
            request.add(tvrequest2);
        } catch (Exception e) {
            // TODO: handle exception
        }
        TermVectorsRequest tvrequestTemplate = new TermVectorsRequest("authors", "fake_id");
        tvrequestTemplate.setFields("user");
        String[] ids = { "1", "2" };
        MultiTermVectorsRequest request2 = new MultiTermVectorsRequest(ids, tvrequestTemplate);
        try {
            MultiTermVectorsResponse response = client.mtermvectors(request, RequestOptions.DEFAULT);
            List<TermVectorsResponse> tvresponseList = response.getTermVectorsResponses();
            if (tvresponseList != null) {
                for (TermVectorsResponse tvresponse : tvresponseList) {
                }
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    public static void main(String[] args) {
        System.out.println("------------ 测试结束 -------------------------");
    }
pom.xml
@@ -548,17 +548,10 @@
            <version>2.1.2</version>
        </dependency>
        <!-- elasticsearch -->
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>transport</artifactId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>7.5.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
            <version>3.2.3.RELEASE</version>
        </dependency>
        <dependency>
utils/src/main/java/org/yeshi/utils/elasticsearch/Document.java
New file
@@ -0,0 +1,16 @@
package org.yeshi.utils.elasticsearch;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Target(ElementType.TYPE)
@Inherited
@Retention(RetentionPolicy.RUNTIME)
public @interface Document {
    String indexName();
}