I have installed elasticsearch version 2.3.2
. I have to add index
and type
to that elasticsearch. Before I used sense plugin to achieve this. But the addon was removed from webstore. Please give suggestion.
5 Answers
Sense plugin is now a Kibana app. Please refer official reference for installation.
The answer of your question is, you can create index and type in Elasticsearch by running below curl command
curl -XPUT "http://localhost:9200/IndexName/TypeName"

- 7,674
- 16
- 65
- 92
-
You have to run this command from command line. In which OS you are trying this ? – Roopendra Oct 16 '17 at 09:09
-
if i run means getting 'curl' is not a recognized command error . – Gopal Oct 16 '17 at 09:11
-
You have to install curl first . – Roopendra Oct 16 '17 at 09:13
You can use a Rest client like postman to do this. You can get the postman as a chrome extension.
The other way is to do an SSH into one of the nodes in your cluster and run the POST command using CURL.
`curl -X POST 'localhost:9200/bookindex/books' -H 'Content-Type: application/json' -d'
{
"bookId" : "A00-3",
"author" : "Sankaran",
"publisher" : "Mcgrahill",
"name" : "how to get a job"
}'
I will automatically create an index named 'bookindex' with type 'books' and index the data. If index and type already exist it will add the entry to the index.

- 965
- 2
- 10
- 28

- 728
- 1
- 10
- 17
All operations in Elasticsearch can be done via REST API calls.
To create an index use the index API
curl -XPUT 'localhost:9200/twitter?pretty' -H 'Content-Type: application/json' -d'{"settings" : {"index" : {"number_of_shards" : 3, "number_of_replicas" : 0 }}}'
To create the mapping the you can use the _mapping
endpoint-
curl -XPUT http://localhost:9200/twitter/tweets/_mapping -d @"create_p4_schema_payload.json"
Here,mapping is provided via a json file name create_p4_schema_payload.json
which contains the following-
{
"properties": {
"user_name": {
"type": "text"
}
}
}
All these can be run via any terminal which supports curl. For windows, you may install cygwin
to run linux command from command prompt.

- 1,566
- 1
- 22
- 42
Like it was said above, you can access it through REST api calls. The command you need to run is:
curl -XPUT 'http://localhost:9200/IndexName?include_type_name=TypeName'
CURL is a raw text that can be imported into Postman, for example, or you can install it's CLI and simply run it. Simply put:
It's a PUT api call to the ElasticSearch/IndexName, adding the Query Parameter include_type_name.
The reference guide is at: Elastic Search - Create index API

- 9
- 2
Sense plugin is removed from chrome webstore. You could use Kibana which has sense like dev-tool to perform ElasticSearch queries.
Follow this link to install kibana.

- 554
- 6
- 15