I created my first AWS ElasticSearch cluster and uploaded some data to it (shown below).
When I search for a domain such as example.com, I get zero results.
Is this a search query or indexing issue?
# curl -XGET -u username:password 'https://xxxxx.us-east-1.es.amazonaws.com/hosts/_search?q=example.com&pretty=true'
{
"took" : 7,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
}
}
I confirmed that a match_all query does return all the records.
match_all
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 3,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "hosts",
"_type" : "_doc",
"_id" : "KK0PcnMBqk4TBzxZPeGU",
"_score" : 1.0,
"_source" : {
"name" : "mail.stackoverflow.com",
"type" : "a",
"value" : "10.0.0.3"
}
},
{
"_index" : "hosts",
"_type" : "_doc",
"_id" : "J60PcnMBqk4TBzxZPeGU",
"_score" : 1.0,
"_source" : {
"name" : "ns1.guardian.co.uk",
"type" : "a",
"value" : "10.0.0.2"
}
},
{
"_index" : "hosts",
"_type" : "_doc",
"_id" : "Ka0PcnMBqk4TBzxZPeGU",
"_score" : 1.0,
"_source" : {
"name" : "test.example.com",
"type" : "a",
"value" : "10.0.0.4"
}
}
]
}
}
Bulk Upload Command
curl -XPUT -u username:password https://xxxxx.us-east-1.es.amazonaws.com/_bulk --data-binary @bulk.json -H 'Content-Type: application/json'
bulk.json
{ "index" : { "_index": "hosts" } }
{"name":"ns1.guardian.co.uk","type":"a","value":"10.0.0.2"}
{ "index" : { "_index": "hosts" } }
{"name":"mail.stackoverflow.com","type":"a","value":"10.0.0.3"}
{ "index" : { "_index": "hosts" } }
{"name":"test.example.com","type":"a","value":"10.0.0.4"}