Reputation: 65
I'm new to elasticsearch. And can't to find out how to make correct request to an index and an type within JSON request? (So i'd like to not use index and type in URL like localhost:9200/myindex/mytype/_search , but to make JSON request to localhost:9200/_search )
I tried something like this. But i got results from 'aaa' index instead of 'bbb' index. How to get results only from bbb index or no results at all?
{
"query": {
"indices": {
"indices": [
"bbb"
],
"query": {
"bool": {
"must": [
{
"range": {
"apps.vol": {
"lte": 1
}
}
},
{
"term": {
"apps.status": 2
}
}
],
"must_not": [],
"should": []
}
}
}
}
,"size":2,"sort":[],"facets":{}
}
Upvotes: 1
Views: 565
Reputation: 17155
According to http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-indices-query.html, the default no_match_query is "all". You need to add "no_match_query" : "none"
at the same level as your "query":
Upvotes: 2