Search in sources :

Example 1 with ESMapResponseHandler

use of org.frameworkset.elasticsearch.handler.ESMapResponseHandler in project bboss-elastic by bbossgroups.

the class ESTest method testConfig.

@Test
public void testConfig() throws ParseException {
    ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("estrace/ESTracesMapper.xml");
    TraceExtraCriteria traceExtraCriteria = new TraceExtraCriteria();
    traceExtraCriteria.setApplication("testweb1");
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    traceExtraCriteria.setStartTime(dateFormat.parse("2017-09-02 00:00:00").getTime());
    traceExtraCriteria.setEndTime(dateFormat.parse("2017-09-10 00:00:00").getTime());
    String data = clientUtil.executeRequest("trace-*/_search", "queryPeriodsTopN", traceExtraCriteria, new ESStringResponseHandler());
    System.out.println("------------------------------");
    System.out.println(data);
    System.out.println("------------------------------");
    Map<String, Object> response = clientUtil.executeRequest("trace-*/_search", "queryPeriodsTopN", traceExtraCriteria, new ESMapResponseHandler());
    if (response.containsKey("error")) {
        return;
    }
}
Also used : ESMapResponseHandler(org.frameworkset.elasticsearch.handler.ESMapResponseHandler) FastDateFormat(org.frameworkset.util.FastDateFormat) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) ClientInterface(org.frameworkset.elasticsearch.client.ClientInterface) ESStringResponseHandler(org.frameworkset.elasticsearch.handler.ESStringResponseHandler) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Example 2 with ESMapResponseHandler

use of org.frameworkset.elasticsearch.handler.ESMapResponseHandler in project bboss-elastic by bbossgroups.

the class ESTest method testSearh.

@Test
public void testSearh() throws ParseException {
    ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("org/frameworkset/elasticsearch/ESTracesMapper.xml");
    TraceExtraCriteria traceExtraCriteria = new TraceExtraCriteria();
    traceExtraCriteria.setApplication("testweb1");
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    traceExtraCriteria.setStartTime(dateFormat.parse("2017-09-02 00:00:00").getTime());
    traceExtraCriteria.setEndTime(dateFormat.parse("2017-09-10 00:00:00").getTime());
    String data = clientUtil.executeRequest("trace-*/_search", "queryPeriodsTopN", traceExtraCriteria, new ESStringResponseHandler());
    System.out.println("------------------------------");
    System.out.println(data);
    System.out.println("------------------------------");
    Map<String, Object> response = clientUtil.executeRequest("trace-*/_search", "queryPeriodsTopN", traceExtraCriteria, new ESMapResponseHandler());
    if (response.containsKey("error")) {
        return;
    }
}
Also used : ESMapResponseHandler(org.frameworkset.elasticsearch.handler.ESMapResponseHandler) FastDateFormat(org.frameworkset.util.FastDateFormat) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) ClientInterface(org.frameworkset.elasticsearch.client.ClientInterface) ESStringResponseHandler(org.frameworkset.elasticsearch.handler.ESStringResponseHandler) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Example 3 with ESMapResponseHandler

use of org.frameworkset.elasticsearch.handler.ESMapResponseHandler in project bboss-elastic by bbossgroups.

the class ESTest method testSearhHits.

@Test
public void testSearhHits() throws ParseException {
    ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("org/frameworkset/elasticsearch/ESTracesMapper.xml");
    TraceExtraCriteria traceExtraCriteria = new TraceExtraCriteria();
    traceExtraCriteria.setApplication("testweb1");
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    traceExtraCriteria.setStartTime(dateFormat.parse("2017-09-02 00:00:00").getTime());
    traceExtraCriteria.setEndTime(dateFormat.parse("2017-09-10 00:00:00").getTime());
    String data = clientUtil.executeRequest("trace-*/_search", "queryPeriodsTopN", traceExtraCriteria, new ESStringResponseHandler());
    System.out.println("------------------------------");
    System.out.println(data);
    System.out.println("------------------------------");
    Map<String, Object> response = clientUtil.executeRequest("trace-*/_search", "queryPeriodsTopN", traceExtraCriteria, new ESMapResponseHandler());
    if (response.containsKey("error")) {
        return;
    }
}
Also used : ESMapResponseHandler(org.frameworkset.elasticsearch.handler.ESMapResponseHandler) FastDateFormat(org.frameworkset.util.FastDateFormat) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) ClientInterface(org.frameworkset.elasticsearch.client.ClientInterface) ESStringResponseHandler(org.frameworkset.elasticsearch.handler.ESStringResponseHandler) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Aggregations

DateFormat (java.text.DateFormat)3 SimpleDateFormat (java.text.SimpleDateFormat)3 ClientInterface (org.frameworkset.elasticsearch.client.ClientInterface)3 ESMapResponseHandler (org.frameworkset.elasticsearch.handler.ESMapResponseHandler)3 ESStringResponseHandler (org.frameworkset.elasticsearch.handler.ESStringResponseHandler)3 FastDateFormat (org.frameworkset.util.FastDateFormat)3 Test (org.junit.Test)3