Elasticsearch 參考指南(匹配全部查詢)

匹配全部查詢

最簡單的查詢,匹配全部文檔,使它們的_score爲1.0。json

GET /_search
{
    "query": {
        "match_all": {}
    }
}

或curl命令:app

curl -X GET "localhost:9200/_search" -H 'Content-Type: application/json' -d'
{
    "query": {
        "match_all": {}
    }
}
'

可使用boost參數更改_scorecurl

GET /_search
{
    "query": {
        "match_all": { "boost" : 1.2 }
    }
}

或curl命令:url

curl -X GET "localhost:9200/_search" -H 'Content-Type: application/json' -d'
{
    "query": {
        "match_all": { "boost" : 1.2 }
    }
}
'

匹配無查詢

這是match_all查詢的相反,它不匹配任何文檔。code

GET /_search
{
    "query": {
        "match_none": {}
    }
}

或curl命令:文檔

curl -X GET "localhost:9200/_search" -H 'Content-Type: application/json' -d'
{
    "query": {
        "match_none": {}
    }
}
'
相關文章
相關標籤/搜索