Elasticsearch 子查詢


curl -XPOST 'xxxx:9200/yl1001search_2015/groups/_search?pretty=true' -d '
{
  "query": {
    "bool": {
      "must": [
        {
          "terms": {
            "group_audit_status": [
              5,
              99
            ]
          }
        },
        {
          "bool": {
            "should": [
              {
                "multi_match": {
                  "query": "650016",
                  "fields": [
                    "ygroup_name^3",
                    "ygroup_tag_names",
                    "ygroup_intro"
                  ],
                  "minimum_should_match": 1
                }
              },
              {
                "term": {
                  "group_code": "650016"
                }
              }
            ]
          }
        }
      ],
      "should": [
        {
          "terms": {
            "group_open_status": [
              1,
              100
            ]
          }
        },
        {
          "has_child": { // 子查詢
            "type": "groups_person",
            "query": {
              "term": {
                "person_id": "12819671"
              }
            }
          }
        }
      ],
      "minimum_should_match": 1
    }
  },
  "size": 10,
  "from": 0,
  "sort": {
    "_score": {
      "order": "desc"
    }
  },
  "highlight": {
    "fields": {
      "ygroup_name": {}
    },
    "pre_tags": [
      "<font color=red>"
    ],
    "post_tags": [
      "</font>"
    ]
  }
}'


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章