Search in sources :

Example 1 with TemplateModuleInstance

use of com.shencangsheng.view.module.TemplateModuleInstance in project View-Elasticsearch by shencangsheng.

the class QueryTest method main.

public static void main(String[] args) throws Exception {
    FileReader templateJson = new FileReader("template.json");
    String queryJson = templateJson.readString();
    ObjectMapper objectMapper = new ObjectMapper();
    List<QueryInstance> queryInstances = objectMapper.readValue(queryJson, new TypeReference<>() {
    });
    BoolQueryBuilder boolQueryBuilder = BoolQueryBuilderFactory.boolQueryBuilderFactory(queryInstances, new TemplateModuleInstance());
    System.out.println(boolQueryBuilder);
}
Also used : QueryInstance(com.shencangsheng.view.query.model.QueryInstance) TemplateModuleInstance(com.shencangsheng.view.module.TemplateModuleInstance) BoolQueryBuilder(org.elasticsearch.index.query.BoolQueryBuilder) FileReader(cn.hutool.core.io.file.FileReader) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

FileReader (cn.hutool.core.io.file.FileReader)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 TemplateModuleInstance (com.shencangsheng.view.module.TemplateModuleInstance)1 QueryInstance (com.shencangsheng.view.query.model.QueryInstance)1 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)1