像分类形式的,比如json如下:
[
{
"param": "a",
"field": [
1,
2,
3,
4,
5
]
},
{
"param": "b",
"field": [
1,
5
]
},
{
"param": "c",
"field": [
2,
5
]
},
{
"param": "d",
"field": [
1,
3
]
}
]
搜索field同时包含有1和2的。或者包含有3或4的。两种检索条件怎么实现?
求QueryDSL
1
ayang23 2015-05-06 23:52:24 +08:00
bool search, must. 上dsl就没意义了
|
2
cevincheung OP @ayang23 bool的话又怎么写?多个条件但是都是同一个字段
|
3
Gonster 2015-05-07 00:25:59 +08:00
|
4
ayang23 2015-05-07 00:27:39 +08:00
{"bool":{"must":[{"term":{"field":1}},{"term":{"field":2}}]}} 应该是这样写
|
5
BlueWolf 2015-05-14 20:20:06 +08:00
{
"query_string" : { "default_field" : "content", "query" : "this AND that OR thus" } } 手册: http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html |