Fulltext search with parent/child and array elements


(Ffoysal) #1
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 ?


(system) #2

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