How to take children filed while use sql query it's parent?

i everyone, i have an parent child index with format like this parent_child ES doc.

     "customer_segment": {
        "type": "join",
        "eager_global_ordinals": true,
        "relations": {
          "customer": "segment"
        }
      }

i find out that ES support query use both SQL and dsl follow this link. then i use this query

POST _sql?format=txt
{
"query": "select customer_id, segment_ids from parent_v3_customers_42348_v2",
  "filter": {
     "has_child": {
      "type": "segment",
      "query": {
        "match_all": {}},
      "max_children": 1,
      "min_children": 1,
      "inner_hits": {}
    }
  }
}

segment_ids is filed of children doc. I know that it's father (customer) still have this field but it just null. My question is how can i retrieve this field by using SQL like above? Here is the result if i use only dsl

 "hits" : [
      {
        "_index" : "parent_child_v3_customers_42348_v2",
        "_type" : "_doc",
        "_id" : "42348:16843175",
        "_score" : 1.0,
        "_source" : {
          "customer_id" : "16843175"
        },
        "inner_hits" : {
          "segment" : {
            "hits" : {
              "total" : {
                "value" : 1,
                "relation" : "eq"
              },
              "max_score" : 1.0,
              "hits" : [
                {
                  "_index" : "parent_child_v3_customers_42348_v2",
                  "_type" : "_doc",
                  "_id" : "42348:16843175:1",
                  "_score" : 1.0,
                  "_routing" : "42348:16843175",
                  "_source" : {
                    "segment_array" : [
                      "887853",
                      "999999",
                      "719652",
                      "742011",
                      "123456",
                      "694817",
                      "872059",
                      "546241"
                    ],
                    "customer_parent" : "16843175",
                    "customer_segment" : {
                      "parent" : "42348:16843175",
                      "name" : "segment"
                    }
                  }
                }
              ]
            }
          }

Thanks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.