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

**URL:** <https://discuss.elastic.co/t/this-is-my-mapping-i-would-like-to-know-where-should-i-define-type-after-index-i-tried-but-it-didnt-work/96178>\
**Category:** Elasticsearch\
**Created:** [August 8, 2017, 4:13am UTC](https://discuss.elastic.co/t/this-is-my-mapping-i-would-like-to-know-where-should-i-define-type-after-index-i-tried-but-it-didnt-work/96178 "2017-08-08T04:13:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akhil\_Prashar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akhil_prashar/32/20313_2.png) [@Akhil\_Prashar](https://discuss.elastic.co/u/Akhil_Prashar)\
**Post date:** [August 8, 2017, 4:13am UTC](https://discuss.elastic.co/t/this-is-my-mapping-i-would-like-to-know-where-should-i-define-type-after-index-i-tried-but-it-didnt-work/96178/1 "2017-08-08T04:13:24Z")

</div>

\<?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); ?\>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 5, 2017, 4:13am UTC](https://discuss.elastic.co/t/this-is-my-mapping-i-would-like-to-know-where-should-i-define-type-after-index-i-tried-but-it-didnt-work/96178/2 "2017-09-05T04:13:41Z")

</div>

Closed on September 5, 2017, 4:13am UTC

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