我是弹性搜索的新手 . 并且无法找出如何在JSON请求中对索引和类型提出正确的请求? (所以我不想在URL中使用索引和类型,如localhost:9200 / myindex / mytype / _search,但要向localhost发出JSON请求:9200 / _search)
我试过这样的事 . 但我得到了'aaa'指数而不是'bbb'指数的结果 . 如何仅从bbb索引获得结果或根本没有结果?
{
"query": {
"indices": {
"indices": [
"bbb"
],
"query": {
"bool": {
"must": [
{
"range": {
"apps.vol": {
"lte": 1
}
}
},
{
"term": {
"apps.status": 2
}
}
],
"must_not": [],
"should": []
}
}
}
}
,"size":2,"sort":[],"facets":{}
}
1 回答
根据http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-indices-query.html,默认的no_match_query是"all" . 您需要在与"query"相同的级别添加
"no_match_query" : "none"
: