Error 403 yii2-elasticsearch

Hello, I want to use the extension yii2-elasticsearch and when I do any search it returns the following error (I tried with the webservers ampps and xamp, without being able to correct it). The error is related to the configuration of the server but I do not know how to correct it, Without more here I leave the error that throws me.

Please, thank you for the help you can lend me, I have never used this extension and as I have been inquiring is the most complete for the realization of searches.

This error gives me using AMPPS:





Elasticsearch Database Exception – yii\elasticsearch\Exception

Elasticsearch request failed with code 403.

Error Info: Array

(

    [requestMethod] => GET

    [requestUrl] => http://127.0.0.1/basic/web:9200/_all/_search?queryParts%5Bsize%5D=10&queryParts%5Bquery%5D%5Bmatch%5D%5Bname%5D=a

    [requestBody] => {"size":10,"query":{"match":{"name":"a"}}}

    [responseCode] => 403

    [responseHeaders] => Array

        (

            [date] => Wed, 19 Apr 2017 00:01:53 GMT

            [server] => Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.10 mod_wsgi/4.4.21 Python/3.5.2

            [content-length] => 236

            [content-type] => text/html; charset=iso-8859-1

        )


    [responseBody] => 





Forbidden


You don't have permission to access /basic/web:9200/_all/_search

on this server.




This one shows me when using XAMPP




Elasticsearch Database Exception - yii \ elasticsearch \ Exception

Elasticsearch request failed with code 403.

Error Info: Array

(

    [RequestMethod] => GET

    [RequestUrl] => http://127.0.0.1/basic/web:9200/_all/_search?queryParts%5Bsize%5D=10&queryParts%5Bquery%5D%5Bmatch%5D%5Bname%5D=a

    [RequestBody] => {"size": 10, "query": {"match": {"name": "a"}}}

    [ResponseCode] => 403

    [ResponseHeaders] => Array

        (

            [Date] => Wed, 19 Apr 2017 00:08:48 GMT

            [Server] => Apache / 2.4.23 (Win32) OpenSSL / 1.0.2h PHP / 5.6.24

            [Vary] => accept-language, accept-charset

            [Accept-ranges] => bytes

            [Transfer-encoding] => chunked

            [Content-type] => text / html; Charset = utf-8

            [Content-language] => en

        )


    [ResponseBody] =>







Access forbidden!



Here I leave the models and driver I am using




Namespace app \ controllers;


Use app \ models \ Elastic;

Use Yii;

Use yii \ web \ Controller;

Use yii \ elasticsearch \ Query;

Use app \ models \ Search;

Class ElasticController extends Controller

{


    Public function actionSearch ()

    {

        $ Elastic = new Search ();

        $ Result = $ elastic-> Searches ('');

        $ Query = Yii :: $ app-> request-> queryParams;

        Var_dump ($ result-> getModels ());

        // return $ this-> render ('search', [

        // 'searchModel' => $ elastic,

        // 'dataProvider' => $ result,

        // 'query' => $ query ['search'],

        //]);

    }


 




<? Php


Namespace app \ models;


Use Yii;


Class Elastic extends \ yii \ elasticsearch \ ActiveRecord

{


    Public function attributes ()

    {


        Return ['name', 'email'];


    }


    


}








<? Php


Namespace app \ models;

Use app \ models \ Elastic;

 

Use yii \ base \ Model;

 

// use yii \ elasticsearch \ ActiveDataProvider;

 

Use yii \ elasticsearch \ Query;

 

Use yii \ elasticsearch \ QueryBuilder;




Class Search extends Elastic


{

    Public function Searches ($ value)

    {

        // die (print_r ($ value ['search']));

        // $ search = $ value ['search'];

        $ Query = new Query ();

        $ Db = Elastic :: getDb ();

        $ QueryBuilder = new QueryBuilder ($ db);

        $ Match = ['match' => ['name' => 'a']];

        $ Query-> query = $ match;

        $ Build = $ queryBuilder-> build ($ query);

        $ Re = $ query-> search ($ db, $ build);

        $ DataProvider = new \ yii \ elasticsearch \ ActiveDataProvider ([

            "Query" => $ query,

            "Pagination" => ["pageSize" => 10]

        ]);

        Return $ dataProvider;

    }

}



Help please!!