Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get elasticsearch schema via commandline tool

I am trying to get up to speed on an elasticsearch implementation on a project. How can I see the data that is on the cluster? Is there a commandline tool that gives me information on the schema?

like image 537
Horse Voice Avatar asked Aug 19 '13 19:08

Horse Voice


People also ask

How do I find Elasticsearch schema?

These can be accessed from your dashboard by choosing Stack Settings > Elasticsearch . The next step is to write a a curl -x get command to retrieve the mappings from Elasticsearch. You will be returned with a json output similar to the below screenshot.

Does Elasticsearch have a schema?

Elasticsearch has the ability to be schema-less, which means that documents can be indexed without explicitly providing a schema. If you do not specify a mapping, Elasticsearch will by default generate one dynamically when detecting new fields in documents during indexing.

How do I get Elasticsearch data?

You can use the search API to search and aggregate data stored in Elasticsearch data streams or indices. The API's query request body parameter accepts queries written in Query DSL. The following request searches my-index-000001 using a match query. This query matches documents with a user.id value of kimchy .


2 Answers

To get schema:

curl -XGET 'http://loadtest-appserver1:9200/myIndex/_mapping'

See Elasticsearch Api Doc

like image 129
runarM Avatar answered Oct 23 '22 04:10

runarM


Try using ElasticSearch Head

http://mobz.github.io/elasticsearch-head/

It's a great tool when peeking in your index and it's meta data (such as the schema) to find out what's going on.

Also it's HTML5/REST based, so you can take a look in your browser at the commands it sends to your cluster and use those with command line CURL if needed.

like image 23
Constantijn Visinescu Avatar answered Oct 23 '22 06:10

Constantijn Visinescu