我是Elasticsearch的新手。而且无法找出如何对索引和类型提出正确的请求
在JSON请求中? (因此,我不想使用index并输入localhost:9200 / myindex / mytype / _search之类的URL,而是向localhost:9200 / _search发出JSON请求)
我尝试过这样的事情。但是我从'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":{}
}
最佳答案
根据http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-indices-query.html,默认的no_match_query是“all”。您需要在与“查询”相同的级别添加"no_match_query" : "none"
:
关于elasticsearch - 查询中的Elasticsearch索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23476665/