ahmedkhan847 / customcms

13 stars 11 forks source link

Installing Elastic Search #1

Open bhavikshah92 opened 7 years ago

bhavikshah92 commented 7 years ago

Hello,

I'm also trying to implement Elastic Search on a PHP and MySQL Site but I'm unable to get start as I searched on it and found that we need to install composer first and then proceed further. Since my server is a shared hosting I'm unable to do the same. Can you help me out the other way to implement ES.

ahmedkhan847 commented 7 years ago

install this project on your local machine then use composer to install required dependencies and then upload the vendor folder in your hosting

bhavikshah92 commented 7 years ago

I have download composer and added vendor folder to the class folder of your code but when I'm searching anything it gives below error

Fatal error: Uncaught exception 'Elasticsearch\Common\Exceptions\NoNodesAvailableException' with message 'No alive nodes found in your cluster' in C:\xampp\htdocs\customcms\class\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php:51 Stack trace: #0 C:\xampp\htdocs\customcms\class\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Transport.php(71): Elasticsearch\ConnectionPool\StaticNoPingConnectionPool->nextConnection() #1 C:\xampp\htdocs\customcms\class\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Transport.php(89): Elasticsearch\Transport->getConnection() #2 C:\xampp\htdocs\customcms\class\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php(188): Elasticsearch\Transport->performRequest('GET', '/blog/article/_...', Array, '{"query":{"matc...', Array) #3 C:\xampp\htdocs\customcms\class\vendor\react\promise\src\FulfilledPromise.php(25): Elasticsearch\Connections\Connection->Elasticsearch\Connections{closure}(Array) #4 C:\xampp\htdocs\cu in C:\xampp\htdocs\customcms\class\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php on line 51

ahmedkhan847 commented 7 years ago

Have you installed elasticsearch on your local machine?

bhavikshah92 commented 7 years ago

Thank you for the error.

Now when I'm updating the record I get below error

Fatal error: Uncaught Elasticsearch\Common\Exceptions\BadRequest400Exception: {"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: script or doc is missing;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: script or doc is missing;"},"status":400} in C:\xampp\htdocs\nnl\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php:525 Stack trace:

0 C:\xampp\htdocs\nnl\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php(208): Elasticsearch\Connections\Connection->process4xxError(Array, Array, Array)

1 C:\xampp\htdocs\nnl\vendor\react\promise\src\FulfilledPromise.php(25): Elasticsearch\Connections\Connection->Elasticsearch\Connections{closure}(Array)

2 C:\xampp\htdocs\nnl\vendor\guzzlehttp\ringphp\src\Future\CompletedFutureValue.php(55): React\Promise\FulfilledPromise->then(Object(Closure), NULL, NULL)

3 C:\xampp\htdocs\nnl\vendor\guzzlehttp\ringphp\src\Core.php(341): GuzzleHttp\Ring\Future\Com in C:\xampp\htdocs\nnl\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php on line 525

I have below data and type in my index

$params = [ 'index' => 'property', 'body' => [ 'mappings' => [ 'propertydetails' => [ 'properties' => [ 'id' => [ 'type' => 'integer'

                                ],
                                'CAPRate' => [
                                    'type' => 'double'

                                ],
                                'ListingTitle' => [
                                    'type' => 'string'

                                ],
                                'ListPrice' => [
                                    'type' => 'double'
                                ],
                                'PropertyType' => [
                                    'type' => 'string'

                                ],
                                'State' => [
                                    'type' => 'string'

                                ],
                                'TenancySummary' => [
                                    'type' => 'string'

                                ],
                                'TermRemaining' => [
                                    'type' => 'integer'
                                ],
                                'PhotoName' => [
                                    'type' => 'string'

                                ],
                            ]
                        ]
                    ]
                ]
            ];