{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/1817","repository_url":"https://api.github.com/repos/elastic/elasticsearch-net","labels_url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/1817/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/1817/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/1817/events","html_url":"https://github.com/elastic/elasticsearch-net/issues/1817","id":132515721,"number":1817,"title":"Undesirable serialization of conditionless queries when using object initializer syntax","user":{"login":"tuespetre","id":4853540,"avatar_url":"https://avatars.githubusercontent.com/u/4853540?v=3","gravatar_id":"","url":"https://api.github.com/users/tuespetre","html_url":"https://github.com/tuespetre","followers_url":"https://api.github.com/users/tuespetre/followers","following_url":"https://api.github.com/users/tuespetre/following{/other_user}","gists_url":"https://api.github.com/users/tuespetre/gists{/gist_id}","starred_url":"https://api.github.com/users/tuespetre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuespetre/subscriptions","organizations_url":"https://api.github.com/users/tuespetre/orgs","repos_url":"https://api.github.com/users/tuespetre/repos","events_url":"https://api.github.com/users/tuespetre/events{/privacy}","received_events_url":"https://api.github.com/users/tuespetre/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-09T19:51:14Z","updated_at":"2016-02-09T19:59:53Z","closed_at":null,"body":"When using the object initializer syntax, any property that accepts `IEnumerable<QueryContainer>` (for example, `BoolQuery.Must`) is serialized with a `null` value per conditionless query.\r\n\r\nExcerpt of an example query:\r\n\r\n```\r\nvar request = new SearchRequest\r\n{\r\n    Query = new BoolQuery\r\n    {\r\n        Must = new List<QueryContainer>\r\n        {\r\n            new QueryStringQuery\r\n            {\r\n                Query = someNotNullNotEmptyString\r\n            },\r\n            new QueryStringQuery\r\n            {\r\n                Query = someNullString\r\n            },\r\n            new QueryStringQuery\r\n            {\r\n                Query = someEmptyString\r\n            },\r\n        }\r\n    }\r\n};\r\n```\r\n\r\nExcerpt of the example response:\r\n\r\n`{\"must\":[{\"query_string\":{\"query\":\"some search terms\"}},null,null]}`\r\n\r\nExpected:\r\n\r\n`{\"must\":[{\"query_string\":{\"query\":\"some search terms\"}}]}`"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/comments/182036369","html_url":"https://github.com/elastic/elasticsearch-net/issues/1817#issuecomment-182036369","issue_url":"https://api.github.com/repos/elastic/elasticsearch-net/issues/1817","id":182036369,"user":{"login":"tuespetre","id":4853540,"avatar_url":"https://avatars.githubusercontent.com/u/4853540?v=3","gravatar_id":"","url":"https://api.github.com/users/tuespetre","html_url":"https://github.com/tuespetre","followers_url":"https://api.github.com/users/tuespetre/followers","following_url":"https://api.github.com/users/tuespetre/following{/other_user}","gists_url":"https://api.github.com/users/tuespetre/gists{/gist_id}","starred_url":"https://api.github.com/users/tuespetre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuespetre/subscriptions","organizations_url":"https://api.github.com/users/tuespetre/orgs","repos_url":"https://api.github.com/users/tuespetre/repos","events_url":"https://api.github.com/users/tuespetre/events{/privacy}","received_events_url":"https://api.github.com/users/tuespetre/received_events","type":"User","site_admin":false},"created_at":"2016-02-09T19:59:53Z","updated_at":"2016-02-09T19:59:53Z","body":"See: https://github.com/elastic/elasticsearch-net/blob/2.0.1/src/Nest/QueryDsl/Abstractions/Query/QueryBase.cs#L72"}}