How to add indexed:has taxonomy term id(with depth) in the contexual filter of view? I have created a view and added indexed fields to that view to show content. 

I want to show content related to taxonomy "related place" as well as its related child taxonomy content. For selecting child taxonomy I used simple hierarchical module, but the problem I am facing is that I'm not getting any option to select Indexed:has taxonomy term id(with depth) in contexual filter to show content .

The propose of using indexed fields in views for filtering content using facet api. 

I've tried everything to achieve this, but no result.
In custom module


you can use hook__views_pre_view to change contextual filter,
add children terms till depth to the contextual filter,
function taxonomy_get_children_all() defined below, will fetch all child terms till depth:
In view, don't forget to allow multiple value contextual filter for contextual filter.

function taxonomy_get_children_all($tid, $vid = 0, $key = 'tid'){
  $c = taxonomy_get_children($tid, $vid, $key);
  $result = array();
  foreach ($c as $t =&gt; $d){
    $result[$t] = $d;
    $below = taxonomy_get_children_all($t, $vid, $key);
    if (!empty($below)) {
       foreach ($below as $nt =&gt; $nd){
         $result[$nt] = $nd;
       }
    }
 }
 return $result;
 }


 function formalter_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args){
 if($view-&gt;name == "category_view") { // &amp;&amp; $display_id == "page") {
   $vid = &lt;Your vocabulary id&gt;;

   $t = $args[0];

   $tt = taxonomy_get_children_all($t,$vid);
   foreach($tt as $k =&gt; $v) {
     $a = (string)$k;
     $args[0] = $args[0] . "+" . $a;
   }
 }
}