Json for Indexing Data in Elastic Search using C#.Net

pl help

On Monday, April 14, 2014 3:59:04 PM UTC+5:30, Mariusz Donigiewicz wrote:
>
> Hi 
> I believe this is not the first topic for this sort of questions.
>
> What i wanted to achieve is to be able to effectively query for in generic 
> structure  of entities (lets say categories)
>
> {
>   "mdm" : {
>     "mappings" : {
>       "categories" : {
>         "_parent" : {
>           "type" : "categories"
>         },
>         "_routing" : {
>           "required" : true
>         },
>         "properties" : {
>           "category_description" : {
>             "type" : "string"
>           },
>           "category_id" : {
>             "type" : "long"
>           },
>           "category_parent" : {
>             "type" : "string"
>           },
>           "category_path" : {
>             "type" : "string"
>           },
>           "category_title" : {
>             "type" : "string"
>           }
>         }
>       }
>     }
>   }
> }
>
> If put some data to index 
>
> {"category_id":10000,"category_title":"clothes","category_description":"all 
> clothes", "category_path" :"10000"}
> {"category_id":10001,"category_title":"shirts","category_description":"just 
> shirts clothes", "category_parent" : "10000" ,"category_path" 
> :"10000/10001"}
> {"category_id":10002,"category_title":"summer 
> shirt","category_description":"just summer clothes", "category_parent" : 
> "10001", "category_path" :"10000/10001/10002"}
> {"category_id":10003,"category_title":"baby 
> shirt","category_description":"just baby clothes", "category_parent" : 
> "10001", "category_path" :"10000/10001/10003"}
> {"category_id":10004,"category_title":"boys baby 
> ","category_description":"just a boy baby shirts", "category_parent" : 
> "10003", "category_path" :"10000/10001/10003/10004"}
> {"category_id":10005,"category_title":"girls baby 
> ","category_description":"just a girl baby shirts", "category_parent" : 
> "10003", "category_path" :"10000/10001/10003/10005"}
>
> {"category_id":10006,"category_title":"trouses","category_description":"all 
> trouses", "category_parent" : "10000" ,"category_path" :"10000/10006"}
> {"category_id":10007,"category_title":"jeans","category_description":"all 
> jeans", "category_parent" : "10006" ,"category_path" :"10000/10006/10007"}
> {"category_id":10008,"category_title":"chinos","category_description":"chinos 
> jeans", "category_parent" : "10006" ,"category_path" :"10000/10006/10008"}
> {"category_id":10009,"category_title":"chinos + 
> tshirt","category_description":"chinos jeans", "category_parent" : "10009" 
> ,"category_path" :"10000/10006/10008/10009"}
>
> I wan't to fullfill my business use case 
>
> UC1 : Give me all sub categories of the given one for its title, 
> description ....
>
> Addtionally I have put the calculated category_path to be able to easier 
> navigate through out the tree.
>
> The question is this possible  (ideally only query time, without providing 
> any flatting fields)  to query and fullfill the  UC1.
>
> I have tried a query like 
>
> {
>   "query" : {
>     "match_all" : { }
>   },
>   "post_filter" : {
>     "has_parent" : {
>       "query" : {
>         "match" : {
>           "category_title" : {
>             "query" : "*shirt",
>             "type" : "boolean"
>           }
>         }
>       },
>       "parent_type" : "categories"
>     }
>   },
>   "explain" : true
> }
>
> {
>   "query" : {
>     "match_all" : { }
>   },
>   "post_filter" : {
>     "has_parent" : {
>       "query" : {
>         "regexp" : {
>           "category_title" : {
>             "value" : ".*shirt"
>           }
>         }
>       },
>       "parent_type" : "categories"
>     }
>   },
>   "explain" : true
> }
>
>
> But it is not working as it should - reading documentation it also has no 
> capabilities to work in tree like manner.
>
> Is it possible to get within one query for criteria like : "category_title" 
> : "*shirt"
>
> And retrieve the data  from different sub tree branches with in one query 
> ???
>
> {"category_id":10002,"category_title":"summer 
> shirt","category_description":"just summer clothes", "category_parent" : 
> "10001", "category_path" :"10000/10001/10002"}
> {"category_id":10003,"category_title":"baby 
> shirt","category_description":"just baby clothes", "category_parent" : 
> "10001", "category_path" :"10000/10001/10003"}
> {"category_id":10004,"category_title":"boys baby 
> ","category_description":"just a boy baby shirts", "category_parent" : 
> "10003", "category_path" :"10000/10001/10003/10004"}
> {"category_id":10005,"category_title":"girls baby 
> ","category_description":"just a girl baby shirts", "category_parent" : 
> "10003", "category_path" :"10000/10001/10003/10005"}
> {"category_id":10009,"category_title":"chinos + 
> t-shirt","category_description":"chinos jeans", "category_parent" : "10009" 
> ,"category_path" :"10000/10006/10008/10009"}
>
>
> Regards M.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/f52b3910-7a6c-47cd-819c-cd485bc6925f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to