package cn.focus.dc.app.xinfang.service.third;
import static cn.focus.dc.app.constants.AppConstants.ES_INDEX_PASSWORD;
import io.searchbox.client.JestClient;
import io.searchbox.client.JestResult;
import io.searchbox.core.Delete;
import io.searchbox.core.Index;
import io.searchbox.core.Search;
import io.searchbox.indices.CreateIndex;
import io.searchbox.indices.mapping.GetMapping;
import io.searchbox.indices.mapping.PutMapping;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.gson.JsonObject;
import cn.focus.dc.app.exception.EsSearchException;
import cn.focus.dc.app.xinfang.model.es.qry.EsQuery;
import cn.focus.dc.app.xinfang.model.es.rst.EsResult;
import cn.focus.dc.app.xinfang.model.es.rst.Result;
@Service
public class EsAdvancedService {
private static final String PWDKEY = "X-SCE-ES-PASSWORD";
private static Logger logger = LoggerFactory.getLogger(EsAdvancedService.class);
@Autowired
private JestClient jestClient;
/**
* 创建索引
* @param indexName
* @return
*/
public boolean createIndex(String indexName){
CreateIndex createIndex = new CreateIndex(new CreateIndex.Builder(indexName));
try{
JestResult result = jestClient.execute(createIndex);
if(result == null || !result.isSucceeded()){
throw new Except
import static cn.focus.dc.app.constants.AppConstants.ES_INDEX_PASSWORD;
import io.searchbox.client.JestClient;
import io.searchbox.client.JestResult;
import io.searchbox.core.Delete;
import io.searchbox.core.Index;
import io.searchbox.core.Search;
import io.searchbox.indices.CreateIndex;
import io.searchbox.indices.mapping.GetMapping;
import io.searchbox.indices.mapping.PutMapping;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.gson.JsonObject;
import cn.focus.dc.app.exception.EsSearchException;
import cn.focus.dc.app.xinfang.model.es.qry.EsQuery;
import cn.focus.dc.app.xinfang.model.es.rst.EsResult;
import cn.focus.dc.app.xinfang.model.es.rst.Result;
@Service
public class EsAdvancedService {
private static final String PWDKEY = "X-SCE-ES-PASSWORD";
private static Logger logger = LoggerFactory.getLogger(EsAdvancedService.class);
@Autowired
private JestClient jestClient;
/**
* 创建索引
* @param indexName
* @return
*/
public boolean createIndex(String indexName){
CreateIndex createIndex = new CreateIndex(new CreateIndex.Builder(indexName));
try{
JestResult result = jestClient.execute(createIndex);
if(result == null || !result.isSucceeded()){
throw new Except