ElasticSearch:字段--精确查询||模糊查询

ES数据类型

           "ent_name": {
                "type": "text",
                "store": true,
                "index": true,
                "search_analyzer": "ik_smart",
                "analyzer": "ik_max_word",
                "fields": {
                    "raw": { 
                      "type":  "keyword"
                    }
                }
            }

模糊查询:

GET ${indexName}/_doc/_search
{
    "query": {
        "query_string":{
            "query":"北京",
            "default_field" : "ent_name"
        }
        
    }
}

精确查询:

GET ${indexName}/_doc/_search
{
    "query": {
        "term": {
            "ent_name.raw": "上海齐鲜餐饮有限公司"
        }
    }
}

你可能感兴趣的:(ElasticSearch:字段--精确查询||模糊查询)