# Fulltext search with parent/child and array elements

**URL:** https://discuss.elastic.co/t/fulltext-search-with-parent-child-and-array-elements/117703
**Category:** Elasticsearch
**Created:** [January 30, 2018, 9:05pm UTC](https://discuss.elastic.co/t/fulltext-search-with-parent-child-and-array-elements/117703 "2018-01-30T21:05:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ffoysal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ffoysal/32/21037_2.png) [@ffoysal](https://discuss.elastic.co/u/ffoysal)
#### Post date: [January 30, 2018, 9:05pm UTC](https://discuss.elastic.co/t/fulltext-search-with-parent-child-and-array-elements/117703/1 "2018-01-30T21:05:31Z")

</div>

```
PUT user_order_idx
{
  "mappings": {
    "doc": {
  "properties": {
    "my_join_field": { 
      "type": "join",
      "relations": {
        "user": "order" 
        }
      }
    }
  }
 }
}

PUT user_order_idx/doc/1?refresh
{
  "user_firstname":"afasfsaf",
  "user_lastname":"jhon",
 "my_join_field": {
   "name": "program"
},
"domain":["domain1","domain2"]

```

}

```
PUT user_order_idx/doc/2?routing=1&refresh
{
 "order_number":1,
 "order_details":"product1"
 "my_join_field":{
  "name": "order",
  "parent": "1"
 }
}

PUT user_order_idx/doc/3?routing=1&refresh
{
 "order_number":2,
 "order_details":"product3"
 "my_join_field":{
  "name": "order",
  "parent": "1"
 }
}

```

my fulltext query is like this

```
GET user_order_idx/_search
{
   "query": {
   "has_child":{
      "type":"order",
        "query":{
           "query_string" : {
               "query" : "+(+(user_lastname:jhon) +domain:domain1 +order_details:product1)" 
      }
    }, "inner_hits": {}
   }
 }
}

```

it returns

```
{
  "took": 6,
  "timed_out": false,
  "_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
 },
 "hits": {
  "total": 0,
"max_score": null,
"hits": []
}
}

```

How can make it work ?

---

<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: [February 27, 2018, 9:05pm UTC](https://discuss.elastic.co/t/fulltext-search-with-parent-child-and-array-elements/117703/2 "2018-02-27T21:05:40Z")

</div>

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