One - One Code All

Blog Content

Elasticsearch使用多个范围进行查询

ElasticSearch   2020-11-03 20:06:20

Elasticsearch使用多个范围进行查询,在bool查询must子句下,无需将其包装在中and。

curl -XPOST -H 'Content-Type: application/json' 'localhost:9200/assistant_dialog_202010/_search?pretty' -d '
{
    "size": 20,
    "query": {
        "bool": {
            "must": [{
                    "range": {
                        "durationTime": {
                            "gte": 3
                        }
                    }
                }, {
                    "range": {
                        "startTime": {
                            "gte": 1603296000
                        }
                    }
                }
            ],

            "filter": [{
                    "term": {
                        "assistantId": "711811"
                    }
                }
            ]
        }
    }
}
'   > assistant_dialog_20201022_711811_20.txt



上一篇:RHSA-2020:2664-重要: 内核 安全和BUG修复更新
下一篇:springboot Feign请求失败异常feign.FeignException.errorExecuting

The minute you think of giving up, think of the reason why you held on so long.