/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function getIndex(Request $request)
 {
     $terms = [];
     $group = false;
     $from = 0;
     $size = 25;
     foreach ($request->all() as $key => $value) {
         if ('q' === $key) {
             $terms['keyword'] = $value;
         } elseif ('group' === $key) {
             $group = true;
         } elseif ('from' === $key) {
             $from = $value;
         } elseif ('size' === $key) {
             $size = $value;
         } else {
             $terms['filter'][$key] = strtolower($value);
         }
     }
     $results = $this->search->search($terms, $from, $size, $group);
     return ApiResponseFactory::MakeEnvelope($this->parseResultsToResponse($results));
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->info("Creating elasticsearch index");
     $this->search->createIndex();
     $this->search->insertDocument(array());
 }