elasticsearch - 查询中的Elasticsearch索引

标签 elasticsearch querydsl

我是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/

相关文章:

elasticsearch - 在ElasticSearch中搜索查询分数详细信息

java - 如何使用 QueryDsl Maven 插件生成 RelationalPath 派生类?

java - Querydsl 空安全串联

c# - 题-ElasticSearch-Nest v7.x “Ignore = true”在字段上不起作用

elasticsearch - 使用 Elasticsearch asciifolding 忽略特定字符

elasticsearch - 如何在ElasticSearch中显示DSL(查询)处理?

docker - 无法使用 java 8 安装 ElasticSearch 镜像

ruby-on-rails - Rails/Tire –防止索引属性

java - QueryDSL 中的 Mysql 日期函数

jquery - Hibernate Search:如何查询父类中的字段?