use of org.frameworkset.elasticsearch.client.ClientInterface in project bboss-elastic by bbossgroups.
the class CharEscapeUtilTest method escape.
@Test
public void escape() {
StringWriter writer = new StringWriter();
CharEscapeUtil charEscapeUtil = new CustomCharEscapeUtil(writer, false);
charEscapeUtil.writeString("/+\"\\", true);
System.out.println(writer.toString());
writer = new StringWriter();
charEscapeUtil = new CustomCharEscapeUtil(writer, true);
charEscapeUtil.writeString("&/+\"\\", true);
System.out.println(writer.toString());
ClientInterface util = (ConfigRestClientUtil) ElasticSearchHelper.getConfigRestClientUtil("demo7.xml");
Map params = new HashMap();
params.put("aaa", "_&/+\"\\.");
System.out.println(util.evalConfigDsl("testesencode", params));
}
use of org.frameworkset.elasticsearch.client.ClientInterface in project bboss-elastic by bbossgroups.
the class ESTest method testGetmapping.
@Test
public void testGetmapping() {
SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
String date = format.format(new Date());
ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("estrace/ESTracesMapper.xml");
System.out.println(clientUtil.getIndice("demo-" + date));
clientUtil.dropIndice("demo-" + date);
}
use of org.frameworkset.elasticsearch.client.ClientInterface in project bboss-elastic by bbossgroups.
the class ESTest method querey.
@Test
public void querey() throws Exception {
DefaultApplicationContext context = DefaultApplicationContext.getApplicationContext("conf/elasticsearch.xml");
ElasticSearch elasticSearchSink = context.getTBeanObject("elasticSearch", ElasticSearch.class);
// ElasticSearch restelasticSearchSink = context.getTBeanObject("restelasticSearch", ElasticSearch.class);
ClientInterface clientUtil = elasticSearchSink.getRestClientUtil();
String entiry = "{\"query\" : {\"term\" : { \"rpc\" : \"content.page\" }}}";
String response = (String) clientUtil.executeRequest("trace-*/_search", entiry);
System.out.println(response);
}
use of org.frameworkset.elasticsearch.client.ClientInterface 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;
}
}
use of org.frameworkset.elasticsearch.client.ClientInterface in project bboss-elastic by bbossgroups.
the class ESTest method testQueryDocMapping.
@Test
public void testQueryDocMapping() {
ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
System.out.println(clientUtil.getIndexMapping("trace-*", true));
final List<IndexField> fields = clientUtil.getIndexMappingFields("trace-*", "trace");
System.out.println(fields.size());
}
Aggregations