{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/2442","repository_url":"https://api.github.com/repos/elastic/elasticsearch-net","labels_url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/2442/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/2442/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/2442/events","html_url":"https://github.com/elastic/elasticsearch-net/issues/2442","id":193090008,"number":2442,"title":"Timing issue causes no hits","user":{"login":"Reyhn3","id":14642098,"avatar_url":"https://avatars.githubusercontent.com/u/14642098?v=3","gravatar_id":"","url":"https://api.github.com/users/Reyhn3","html_url":"https://github.com/Reyhn3","followers_url":"https://api.github.com/users/Reyhn3/followers","following_url":"https://api.github.com/users/Reyhn3/following{/other_user}","gists_url":"https://api.github.com/users/Reyhn3/gists{/gist_id}","starred_url":"https://api.github.com/users/Reyhn3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Reyhn3/subscriptions","organizations_url":"https://api.github.com/users/Reyhn3/orgs","repos_url":"https://api.github.com/users/Reyhn3/repos","events_url":"https://api.github.com/users/Reyhn3/events{/privacy}","received_events_url":"https://api.github.com/users/Reyhn3/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-02T11:04:28Z","updated_at":"2016-12-02T13:47:42Z","closed_at":"2016-12-02T13:21:08Z","body":"[ESTimingIssue.txt](https://github.com/elastic/elasticsearch-net/files/626988/ESTimingIssue.txt)\r\n**Note**: For some reason, GitHub wouldn't accept the zip-file with a .zip-extension. Rename \"ESTimingIssue.txt\" to \"ESTimingIssue.zip\" and extract the project. Sorry for the inconvenience!\r\n\r\n\r\n**NEST/Elasticsearch.Net version**: 5.0.0-rc4 as well as rc3\r\n\r\n**Elasticsearch version**: 5.0.2 as well as 5.0.1\r\n\r\n**Tested on**: Windows 7 SP1 64-bit, Intel Xeon E3-1246 v3 @ 3.50GHz with 32GB RAM\r\n\r\n**Description of the problem including expected versus actual behavior**:\r\nI'm afraid I don't fully understand the nature of this problem, so I'll provide a code example in hope someone with more insight in ES/NEST can make something out of it.\r\n\r\nIt seems that there is some kind of timing issue that prevents NEST from receiving the result from ES. If the code executes **too fast**, no hits are materialized. If a delay is injected, the same query produces the correct result. Hence, I believe the problem to reside in NEST, not ES.\r\n\r\nIn the `OnRequestCompleted` callback, when a `Thread.Sleep` is added, or simply a breakpoint in debug-mode is hit, the documents are materialized. If none of these are present, no hits are (incorrectly) reported back.\r\n\r\nFrom the debug prints, the raw DSL query is printed, and when using the Sense-extension for Chrome, the very same query produces the expected result.\r\n\r\n**Steps to reproduce**:\r\n 1. Start ElasticSearch locally.\r\n 2. Compile and run the attached example project. The output should state that no results were found.\r\n 3. Uncomment the Thread.Sleep-line and run again. The output should state that results were found.\r\n\r\n**Provide `DebugInformation` (if relevant)**:\r\nNote that the \"pause\" required to make it work seems to depend on the complexity of the code being executed and the hardware. In a more complex index+query, the pause could be reduced to 75ms on my machine.\r\n\r\nOutput **without** delay:\r\n```json\r\nElasticSearch request: Method: POST, Uri: http://localhost:9200/inventory/product/_search?pretty=true, Raw DSL: {\r\n  \"query\": {\r\n    \"term\": {\r\n      \"productId\": {\r\n        \"value\": \"09916a80-47e7-490a-b356-79b98794293f\"\r\n      }\r\n    }\r\n  }\r\n}\r\nElasticSearch response: Raw JSON: {\r\n  \"took\" : 1,\r\n  \"timed_out\" : false,\r\n  \"_shards\" : {\r\n    \"total\" : 5,\r\n    \"successful\" : 5,\r\n    \"failed\" : 0\r\n  },\r\n  \"hits\" : {\r\n    \"total\" : 0,\r\n    \"max_score\" : null,\r\n    \"hits\" : [ ]\r\n  }\r\n}\r\n\r\nNo documents found! ):\r\n```\r\n\r\nOutput **with** delay:\r\n\r\n```json\r\nElasticSearch request: Method: POST, Uri: http://localhost:9200/inventory/product/_search?pretty=true, Raw DSL: {\r\n  \"query\": {\r\n    \"term\": {\r\n      \"productId\": {\r\n        \"value\": \"146814a7-98fd-4db7-a11e-64c849f67db9\"\r\n      }\r\n    }\r\n  }\r\n}\r\nElasticSearch response: Raw JSON: {\r\n  \"took\" : 1,\r\n  \"timed_out\" : false,\r\n  \"_shards\" : {\r\n    \"total\" : 5,\r\n    \"successful\" : 5,\r\n    \"failed\" : 0\r\n  },\r\n  \"hits\" : {\r\n    \"total\" : 1,\r\n    \"max_score\" : 0.2876821,\r\n    \"hits\" : [\r\n      {\r\n        \"_index\" : \"inventory\",\r\n        \"_type\" : \"product\",\r\n        \"_id\" : \"146814a7-98fd-4db7-a11e-64c849f67db9\",\r\n        \"_score\" : 0.2876821,\r\n        \"_source\" : {\r\n          \"productId\" : \"146814a7-98fd-4db7-a11e-64c849f67db9\",\r\n          \"manufacturerId\" : \"2b9524fe-986d-4033-b2ef-86710a905ed7\",\r\n          \"name\" : \"Product A\"\r\n        }\r\n      }\r\n    ]\r\n  }\r\n}\r\n\r\nFound Product A (146814a7-98fd-4db7-a11e-64c849f67db9).\r\n```"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/comments/264457353","html_url":"https://github.com/elastic/elasticsearch-net/issues/2442#issuecomment-264457353","issue_url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/2442","id":264457353,"user":{"login":"Reyhn3","id":14642098,"avatar_url":"https://avatars.githubusercontent.com/u/14642098?v=3","gravatar_id":"","url":"https://api.github.com/users/Reyhn3","html_url":"https://github.com/Reyhn3","followers_url":"https://api.github.com/users/Reyhn3/followers","following_url":"https://api.github.com/users/Reyhn3/following{/other_user}","gists_url":"https://api.github.com/users/Reyhn3/gists{/gist_id}","starred_url":"https://api.github.com/users/Reyhn3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Reyhn3/subscriptions","organizations_url":"https://api.github.com/users/Reyhn3/orgs","repos_url":"https://api.github.com/users/Reyhn3/repos","events_url":"https://api.github.com/users/Reyhn3/events{/privacy}","received_events_url":"https://api.github.com/users/Reyhn3/received_events","type":"User","site_admin":false},"created_at":"2016-12-02T13:47:42Z","updated_at":"2016-12-02T13:47:42Z","body":"> This can be confusing for new users: they index a document and try to search for it, and it just isn’t there. \r\n\r\nD'oh!\r\nThank you for pointing me in the right direction! (:"}}
{"actor":{"display_login":"Reyhn3"}}