This is my mapping, I would like to know where should I define type? after index I tried but it didn't work


(Akhil Prashar) #1
<?php use Elasticsearch\ClientBuilder; require('/home/akhil/Documents/june/elastic/vendor/autoload.php'); /* $hosts = [ '192.168.1.1:9200', // IP + Port '192.168.1.2', // Just IP 'mydomain.server.com:9201', // Domain + Port 'mydomain2.server.com', // Just Domain 'https://localhost', // SSL to localhost 'https://192.168.1.3:9200' // SSL to IP + Port ]; */ $hosts = ["http://localhost:9200"]; $clientBuilder = ClientBuilder::create(); // Instantiate a new ClientBuilder $clientBuilder->setHosts($hosts); // Set the hosts $client = $clientBuilder->build(); // Build the client object $params = [ 'index' => '201706', 'body' => [ 'mappings' => [ 'facebook' => [ '_source' => [ 'enabled' => true ], 'properties' => [ 'feed_id' => [ 'type' => 'string', 'analyzer' => 'standard' ], 'id' => [ 'type' => 'integer' ], 'type' => [ 'type' => 'string', 'analyzer' => 'standard' ], 'message' => [ 'type' => 'string', 'analyzer' => 'standard' ], 'created_at' => [ 'type' => 'date' ], 'updated_time' => [ 'type' => 'date' ], 'sentiment_score' => [ 'type' => 'float' ], 'sentiment_category' => [ 'type' => 'string' ], 'total_shares' => [ 'type' => 'integer' ], 'total_likes' => [ 'type' => 'integer' ], 'total_comments' => [ 'type' => 'integer' ], 'source' => [ 'type' => 'string', 'analyzer' => 'standard' ], 'picture' => [ 'type' => 'string', 'analyzer' => 'standard' ], 'media_type' => [ 'type' => 'string', 'analyzer' => 'standard' ], 'duration' => [ 'type' => 'string', 'analyzer' => 'standard' ], 'name' => [ 'type' => 'string', 'analyzer' => 'standard' ], 'fb_user_id' => [ 'type' => 'integer' ] ] ] ] ] ]; $response = $client->indices()->create($params); print_r($response); ?>

(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.