# Type join,Why do you get no data over 80, but you can get data over 100

**URL:** <https://discuss.elastic.co/t/type-join-why-do-you-get-no-data-over-80-but-you-can-get-data-over-100/310109>\
**Category:** Elasticsearch\
**Created:** [July 20, 2022, 8:18am UTC](https://discuss.elastic.co/t/type-join-why-do-you-get-no-data-over-80-but-you-can-get-data-over-100/310109 "2022-07-20T08:18:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yangyu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yangyu/32/108555_2.png) [@yangyu](https://discuss.elastic.co/u/yangyu)\
**Post date:** [July 20, 2022, 8:18am UTC](https://discuss.elastic.co/t/type-join-why-do-you-get-no-data-over-80-but-you-can-get-data-over-100/310109/1 "2022-07-20T08:18:38Z")

</div>

### Elasticsearch Version

7.17.4

### Installed Plugins

analysis-ik,analysis-pinyin,analysis-stconvert

### Java Version

1.8.0\_331-b09

### OS Version

MacBook-Pro.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE\_ARM64\_T6000 arm64

### Problem Description

[http://127.0.0.1:9200/cust\_label\_father\_son\_model](http://127.0.0.1:9200/cust_label_father_son_model)

```auto
{
    "mappings": {
        "properties": {
            "label": {
                "properties": {
                    "id": {
                        "type": "long"
                    },
                    "age_numvalu":{
                        "type":"integer"
                    },
                    "cust_no": {
                        "type": "text",
                        "analyzer": "simple"
                    },
                    "name": {
                        "type": "text",
                        "analyzer": "simple"
                    },
                    "phone_number": {
                        "type": "text",
                        "analyzer": "simple"
                    },
                    "f1":{"type" : "text", "analyzer": "simple"},
                    "f2":{"type" : "text", "analyzer": "simple"},
                    "f3":{"type" : "keyword"},
                    "f3v":{"type" : "float"}   
                }
            },
            "custDeposit": {
                "properties": {
                    "cust_no": {
                        "type": "text","analyzer": "simple"
                    },
                    "open_account_amont": {
                        "type": "float"
                    },
                    "open_account_date": {
                        "type": "date"
                    }
                }
            },
            "custProduct": {
                "properties": {
                    "cust_no": {
                        "type": "text","analyzer": "simple"
                    },
                    "product_encd": {
                        "type": "text","analyzer": "simple"
                    },
                    "prodct_nm": {
                        "type": "text","analyzer": "simple"
                    },
                    "total_amont": {
                        "type": "float"
                    },
                    "buy_amont": {
                        "type": "float"
                    }
                }
            },
            "relation": {
                "type": "join",
                "relations": {
                    "label": ["custDeposit", "custProduct"]
                }
            }
        }
    }
}

```

**This is the test data：**

```auto
{"index":{"_id":"cust0","routing":"cust0"}}
{"cust_no":"1008263","age_numvalu":10,"name":"cust0","f3v":912.0,"id":"10000","f1":"1","f2":"g","f3":"l","relation":{"name":"label"}}
{"index":{"_index":"cust_label_father_son_model","routing":"cust0"}}
{"buy_amont":"2440","cust_no":"1008263","total_amont":"10364","relation":{"name":"custProduct","parent":"cust0"}}
{"index":{"_index":"cust_label_father_son_model","routing":"cust0"}}
{"buy_amont":"8318","cust_no":"1008263","total_amont":"8705","relation":{"name":"custProduct","parent":"cust0"}}
{"index":{"_index":"cust_label_father_son_model","routing":"cust0"}}
{"buy_amont":"6651","cust_no":"1008263","total_amont":"13456","relation":{"name":"custProduct","parent":"cust0"}}
{"index":{"_index":"cust_label_father_son_model","routing":"cust0"}}
{"buy_amont":"5036","cust_no":"1008263","total_amont":"96117","relation":{"name":"custProduct","parent":"cust0"}}
{"index":{"_index":"cust_label_father_son_model","routing":"cust0"}}
{"buy_amont":"6151","cust_no":"1008263","total_amont":"72155","relation":{"name":"custProduct","parent":"cust0"}}
{"index":{"_index":"cust_label_father_son_model","routing":"cust0"}}
{"open_account_amont":"490362","cust_no":"1008263","open_account_date":"2021-03-02","relation":{"name":"custDeposit","parent":"cust0"}}

```

**I can't get the data by using the following methods：**  
[http://127.0.0.1:9200/cust\_label\_father\_son\_model/\_search](http://127.0.0.1:9200/cust_label_father_son_model/_search)

```auto
{
    "query": {
        "has_child": {
            "type": "custProduct",
            "query": {
                "bool": {
                    "filter": [
                        {
                            "range": {
                                "buy_amont": {
                                    "gte": 80
                                }
                            }
                        },
                        {
                            "match": {
                                "total_amont": 10364
                            }
                        }
                    ]
                }
            }
        }
    }
}

```

**But I can get the data in the following way, why**  
[http://127.0.0.1:9200/cust\_label\_father\_son\_model/\_search](http://127.0.0.1:9200/cust_label_father_son_model/_search)

```auto
{
    "query": {
        "has_child": {
            "type": "custProduct",
            "query": {
                "bool": {
                    "filter": [
                        {
                            "range": {
                                "buy_amont": {
                                    "gte": 100
                                }
                            }
                        },
                        {
                            "match": {
                                "total_amont": 10364
                            }
                        }
                    ]
                }
            }
        }
    }
}

```

**Why do you get no data over 80, but you can get data over 100**

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 17, 2022, 8:19am UTC](https://discuss.elastic.co/t/type-join-why-do-you-get-no-data-over-80-but-you-can-get-data-over-100/310109/2 "2022-08-17T08:19:03Z")

</div>

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