1
votes

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":{}
}
1
what are the documents you are supposed to get from bbb?eliasah
just a few fileds with string and numeric values. Each documents is less than 256 bytes in total.boris

1 Answers

2
votes

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":