ES(elasticsearch) query DSL 查询语法

AFei00 2020-06-25

"query_string": {
      "default_field": "name",
      "query": "被检索的字符串"
    }

"term": {
    "name": "被检索的字符串"
}

"terms": {
    "name": [
        "被检索的字符串1",
        "被检索的字符串2"
    ]
}

"multi_match": {
    "query": "被检索的字符串",
    "fields": [
        "name", "city"
    ]
}

"match": {
    "name": "name 是字段名,这段话是要检索的文本"
}
  
"match_phrase": {
    "name": "完整匹配"
}
  
"range": {
    "age": {
        "gte": 10,
        "lte": 20
    }
}

"bool": {
    "must_not": {
        "term": {
            "name": {
                "value": "被检索的字符串"
            }
        }
    },
    "filter": {
        "exists": {
            "field": "被检查的字段名"
        }
    }
}

相关推荐