Issue with getting data back when using Docker


I have come across a problem where I am not getting any data back when I try to _search an index. I previously followed along with this tutorial. Everything went fine when following along and using the online "Docker Playground" that is mentioned. However, I am currently trying to do something similar on my own machine which is giving me some trouble.

I am using the docker-compose file found on the Install Elasticsearch with Docker page to create my cluster. I get success responses when creating indexes and when putting documents into those indexes. Whenever I try to query the index I get an empty result set back.

PS C:\WINDOWS\system32> Invoke-RestMethod -Method Put `
>> -Uri "http://localhost:9200/customer/_doc/3?pretty" `
>> -ContentType "application/json" -Body @"
>>   { "name" : "John Doe" }
>> "@

_index        : customer
_type         : _doc
_id           : 3
_version      : 1
result        : created
_shards       : @{total=2; successful=2; failed=0}
_seq_no       : 1
_primary_term : 3

However, when I try to retrieve the documents in the index I get:

PS C:\WINDOWS\system32> Invoke-RestMethod http://localhost:9200/customer/_search?pretty

took timed_out _shards                                       hits
---- --------- -------                                       ----
  45     False @{total=1; successful=1; skipped=0; failed=0} @{total=; max_score=1.0; hits=System.Object[]}

I'm at a bit of a loss because I am getting successful responses from the creation of the documents, but they are not being returned when I try to query them.

Thank you for any help in advance!


I have solved the issue and I believe that the problem was my inexperience using PowerShell. However, once I went back and used the docker-compose file with the Kibana and head plug in from the first tutorial I linked I was able to see that the "total" property of the "hits" was showing the correct number. I'm not sure if this was just another thing I was messing up with PS or if it has something to do with the docker file that was being used, but the issue is solved now none the less.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.