I added a single entry to a newly created test index for my local VM's ES instance.
I can retrieve that single entry using the search api where I ask for everything in the index/type --
curl -XGET 'http://localhost:9200/access-log-lines/v1/_search' | json_reformat
Here is the beginning of the output of the single entry in the index:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1.0,
"hits": [
{
"_index": "access-log-lines",
"_type": "v1",
"_id": "1462349702+1816527446-large.pod1.tor.cdx-stag.example.com",
"_score": 1.0,
"_source": {
"@timestamp": "2016-05-04T08:15:02.840Z",
"udn-env": "cdx-local",
"udn-server": "alex.example.comt",
......
I expected to get a hit when I search for this (sole) entry using this curl:
(note from the above output my "_source" has the field named "udn-env" with value "cdx-local".
curl -XGET http://localhost:9200/access-log-lines/_search -d '{ "query" : {"term" : { "udn-env" : "cdx-local" } } } '
However, I get no hits using that query.
-
Why don't I get a hit with that search? I followed the example in this page
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html -
I didn't expect the data to be in source. Why is what was top-level data in LogStash added to source by ES? I generated this entry using logstash and I expected "udn-env" to be at the top-level (as it was in the json I sent to ES) just like "index", "type" and "id". For my purposes, I don't want ES to analyze (I do any analysis I need on the LogStash side). So I plan to use a mapping template to avoid ES server side analysis eventually.
Thanks.