使用elasticsearch中的术语查询项目的所有值

时间:2016-03-04 13:27:41

标签: elasticsearch

以下查询会搜索source_id 2764上的一些内容。

curl -XGET 'localhost:9200/myindex/_search?pretty=true' -d'
{
"query": {
  "bool": {
     "must": [
        {
           "query_string": {
              "default_field": "body",
              "query": "somestring"
           }
        },
        {
           "terms": {
              "source_id": ["27", "64"]
           }
        },
        {
           "has_child": {
              "type": "user_item_relation",
              "query": {
                 "bool": {
                    "must": [
                       {
                          "term": {
                             "user_id": 12
                          }
                       },
                       {
                          "term": {
                             "favorite": 0
}}]}}}}]}}}'

是否有任何方式保留json结构(不删除terms字段或添加或删除任何其他字段),以搜索所有source_id条记录而不仅仅是特定的?。

我正在寻找类似的东西:

{
   "terms": {
      "source_id": *
   }
},

0 个答案:

没有答案
相关问题