package com.dgtis.common.core.utils.sql;


import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author koucx
 * @version 1.0
 * @descption: TODO
 * @company 神州数码通用软件（洛阳）有限公司
 * @copyright (c) 2019 LuoYang DGT Co'Ltd Inc. All rights reserved.
 * @date 2021-01-26
 * @since JDK1.8
 */
public class EsJsonUtil {


    /**
     * 拼装结构
     * @param map
     * @return
     */
    public static String QuerygetMust(Map map){
       Map search = new HashMap();

        Map query = new HashMap();
        Map bool = new HashMap();
        List must = new ArrayList();
        Map term = new HashMap();
        Map param = new HashMap();
        param.putAll(map);
        term.put("term",param);
        must.add(term);
        List must_not = new ArrayList();
        List should = new ArrayList();
        bool.put("must",must);
//        bool.put("must_not",must_not);
//        bool.put("should",should);
        query.put("bool",bool);
        search.put("query",query);
        return JSONObject.toJSONString(search);
    }

}
