Issue with elasticsearch document mapping and reading the data


(Aditya Inapurapu) #1

I have a customer index that I created by following the getting started guide.

curl -XGET 'localhost:9200/customer/_mapping?pretty'
{
"customer" : {
"mappings" : {
"external" : {
"properties" : {
"name" : {
"type" : "string"
}
}
}
}
}
}

I am able to view the information stored in /customer/external/1 as follows:
curl -XGET 'localhost:9200/customer/external/1?pretty'
{
"_index" : "customer",
"_type" : "external",
"_id" : "1",
"_version" : 1,
"found" : true,
"_source":
{
"name": "John Doe"
}

I have another index named 'logstash'

curl -XGET 'localhost:9200/logstash/_mapping?pretty'
{
"logstash" : {
"mappings" : {
"type" : {
"properties" : {
"@timestamp" : {
"type" : "date",
"format" : "dateOptionalTime"
},
"@version" : {
"type" : "long"
},
"data" : {
"properties" : {
"buildDuration" : {
"type" : "long"
},
"buildHost" : {
"type" : "string"
},
"buildLabel" : {
"type" : "string"
},
"buildNum" : {
"type" : "long"
},
"buildVariables" : {
"type" : "object"
},
"displayName" : {
"type" : "string"
},
"fullDisplayName" : {
"type" : "string"
},
"id" : {
"type" : "string"
},
"projectName" : {
"type" : "string"
},
"rootBuildNum" : {
"type" : "long"
},
"rootProjectDisplayName" : {
"type" : "string"
},
"rootProjectName" : {
"type" : "string"
},
"timestamp" : {
"type" : "date",
"format" : "dateOptionalTime"
},
"url" : {
"type" : "string"
}
}
},
"message" : {
"type" : "string"
},
"source" : {
"type" : "string"
},
"source_host" : {
"type" : "string"
}
}
}
}
}
}

I cannot figure out how to display the information that is stored in this logstash index. I can see that there are 36 items in the index, but I cannot figure out how to display even one of them.

curl -XGET 'http://localhost:9200/_cat/indices/logstash?v'
health status index pri rep docs.count docs.deleted store.size pri.store.size
yellow open logstash 5 1 36 0 162.6kb 162.6kb

I have been following the getting started guide, but the customer example they have seems simpler than the one I have in my logstash index. Please help me figure out how to display this information.


(Imran Siddique) #2

If you have _source ON, you can do a match_all [https://www.elastic.co/guide/en/elasticsearch/reference/1.6/query-dsl-match-all-query.html] search, specify fields you are interested to get back and display the information.


(system) #3