{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/29104135","id":29104135,"diff_hunk":"@@ -0,0 +1,137 @@\n+/*\n+ * Licensed to Elasticsearch under one or more contributor\n+ * license agreements. See the NOTICE file distributed with\n+ * this work for additional information regarding copyright\n+ * ownership. Elasticsearch licenses this file to you under\n+ * the Apache License, Version 2.0 (the \"License\"); you may\n+ * not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *    http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+\n+package org.elasticsearch.cluster.metadata;\n+\n+import org.elasticsearch.ElasticsearchParseException;\n+import org.elasticsearch.common.Strings;\n+import org.elasticsearch.common.io.stream.StreamInput;\n+import org.elasticsearch.common.io.stream.StreamOutput;\n+import org.elasticsearch.common.io.stream.Streamable;\n+import org.elasticsearch.common.xcontent.ToXContent;\n+import org.elasticsearch.common.xcontent.XContentBuilder;\n+import org.elasticsearch.common.xcontent.XContentBuilderString;\n+import org.elasticsearch.common.xcontent.XContentParser;\n+\n+import java.io.IOException;\n+import java.util.ArrayList;\n+import java.util.Arrays;\n+import java.util.List;\n+\n+/**\n+ */\n+public class AliasFieldsFiltering implements Streamable, ToXContent {\n+\n+    private String[] includes;\n+\n+    public AliasFieldsFiltering(StreamInput in) throws IOException {\n+        readFrom(in);\n+    }\n+\n+    public AliasFieldsFiltering(String[] includes) {\n+        this.includes = includes;\n+    }\n+\n+    public String[] getIncludes() {\n+        return includes;\n+    }\n+\n+    public void setIncludes(String[] includes) {\n+        this.includes = includes;\n+    }\n+\n+    @Override\n+    public boolean equals(Object o) {\n+        if (this == o) return true;\n+        if (o == null || getClass() != o.getClass()) return false;\n+\n+        AliasFieldsFiltering that = (AliasFieldsFiltering) o;\n+        return Arrays.equals(includes, that.includes);\n+    }\n+\n+    @Override\n+    public int hashCode() {\n+        return Arrays.hashCode(includes);\n+    }\n+\n+    @Override\n+    public void readFrom(StreamInput in) throws IOException {\n+        includes = in.readStringArray();\n+    }\n+\n+    @Override\n+    public void writeTo(StreamOutput out) throws IOException {\n+        out.writeStringArrayNullable(includes);\n+    }\n+\n+    @Override\n+    public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {\n+        builder.startObject(Fields.FIELDS);\n+        if (includes != null) {\n+            builder.startArray(Fields.INCLUDES);\n+            for (String field : includes) {\n+                builder.value(field);\n+            }\n+            builder.endArray();\n+        }\n+        builder.endObject();\n+        return builder;\n+    }\n+\n+    public static AliasFieldsFiltering fromXContext(XContentParser parser) throws IOException {\n+        if (parser.currentToken() != XContentParser.Token.START_OBJECT) {\n+            throw new ElasticsearchParseException(\"Illegal start\");","path":"src/main/java/org/elasticsearch/cluster/metadata/AliasFieldsFiltering.java","position":99,"original_position":99,"commit_id":"8924739e1ad5c7c9765ef190d011d8561ef3dfab","original_commit_id":"8924739e1ad5c7c9765ef190d011d8561ef3dfab","user":{"login":"uboness","id":211019,"avatar_url":"https://avatars.githubusercontent.com/u/211019?v=3","gravatar_id":"","url":"https://api.github.com/users/uboness","html_url":"https://github.com/uboness","followers_url":"https://api.github.com/users/uboness/followers","following_url":"https://api.github.com/users/uboness/following{/other_user}","gists_url":"https://api.github.com/users/uboness/gists{/gist_id}","starred_url":"https://api.github.com/users/uboness/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uboness/subscriptions","organizations_url":"https://api.github.com/users/uboness/orgs","repos_url":"https://api.github.com/users/uboness/repos","events_url":"https://api.github.com/users/uboness/events{/privacy}","received_events_url":"https://api.github.com/users/uboness/received_events","type":"User","site_admin":false},"body":"obscure error message... let's start by \"could not read alias fields filtering from xcontent. expected an object but found [\" + parser.currentToken() + \"] instead\"","created_at":"2015-04-25T21:12:43Z","updated_at":"2015-04-25T21:12:43Z","html_url":"https://github.com/elastic/elasticsearch/pull/10174#discussion_r29104135","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10174","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/29104135"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/10174#discussion_r29104135"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10174"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10174","id":31576308,"html_url":"https://github.com/elastic/elasticsearch/pull/10174","diff_url":"https://github.com/elastic/elasticsearch/pull/10174.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/10174.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/10174","number":10174,"state":"open","locked":false,"title":"add 'fields' parameter to index aliases","user":{"login":"rmuir","id":504194,"avatar_url":"https://avatars.githubusercontent.com/u/504194?v=3","gravatar_id":"","url":"https://api.github.com/users/rmuir","html_url":"https://github.com/rmuir","followers_url":"https://api.github.com/users/rmuir/followers","following_url":"https://api.github.com/users/rmuir/following{/other_user}","gists_url":"https://api.github.com/users/rmuir/gists{/gist_id}","starred_url":"https://api.github.com/users/rmuir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmuir/subscriptions","organizations_url":"https://api.github.com/users/rmuir/orgs","repos_url":"https://api.github.com/users/rmuir/repos","events_url":"https://api.github.com/users/rmuir/events{/privacy}","received_events_url":"https://api.github.com/users/rmuir/received_events","type":"User","site_admin":false},"body":"index aliases currently allow filtering horizontically (subset of documents), the idea here is to add vertical filtering as well (subset of fields). This is akin to creating an SQL view with only some of the fields from the table.\r\n\r\nthis is an initial hackathon hack from @martijnvg and I, and could definitely use some help and extra eyes.\r\n\r\nA few notes:\r\n* the impl is basically FieldFilterLeafReader from lucene's test-framework[1], except with some special handling for ES internal meta fields like _source and _field_names. \r\n* internal meta fields like _uid/_parent/_source/ are always allowed, otherwise features may break. A notable exception is _all, which is currently always filtered out.\r\n* these aliases are still lightweight: fielddata caches are shared with the underlying index. but in this iteration, filter cache is not used (this would be complex but nice to fix)\r\n\r\n[1] http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/test-framework/src/java/org/apache/lucene/index/FieldFilterLeafReader.java?view=markup","created_at":"2015-03-19T23:27:13Z","updated_at":"2015-04-25T21:12:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b6e2db7ae58f0c45758b4cdbb771f0492332214","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10174/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10174/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/10174/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/8924739e1ad5c7c9765ef190d011d8561ef3dfab","head":{"label":"rmuir:filterreader","ref":"filterreader","sha":"8924739e1ad5c7c9765ef190d011d8561ef3dfab","user":{"login":"rmuir","id":504194,"avatar_url":"https://avatars.githubusercontent.com/u/504194?v=3","gravatar_id":"","url":"https://api.github.com/users/rmuir","html_url":"https://github.com/rmuir","followers_url":"https://api.github.com/users/rmuir/followers","following_url":"https://api.github.com/users/rmuir/following{/other_user}","gists_url":"https://api.github.com/users/rmuir/gists{/gist_id}","starred_url":"https://api.github.com/users/rmuir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmuir/subscriptions","organizations_url":"https://api.github.com/users/rmuir/orgs","repos_url":"https://api.github.com/users/rmuir/repos","events_url":"https://api.github.com/users/rmuir/events{/privacy}","received_events_url":"https://api.github.com/users/rmuir/received_events","type":"User","site_admin":false},"repo":{"id":17824809,"name":"elasticsearch","full_name":"rmuir/elasticsearch","owner":{"login":"rmuir","id":504194,"avatar_url":"https://avatars.githubusercontent.com/u/504194?v=3","gravatar_id":"","url":"https://api.github.com/users/rmuir","html_url":"https://github.com/rmuir","followers_url":"https://api.github.com/users/rmuir/followers","following_url":"https://api.github.com/users/rmuir/following{/other_user}","gists_url":"https://api.github.com/users/rmuir/gists{/gist_id}","starred_url":"https://api.github.com/users/rmuir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmuir/subscriptions","organizations_url":"https://api.github.com/users/rmuir/orgs","repos_url":"https://api.github.com/users/rmuir/repos","events_url":"https://api.github.com/users/rmuir/events{/privacy}","received_events_url":"https://api.github.com/users/rmuir/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rmuir/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/rmuir/elasticsearch","forks_url":"https://api.github.com/repos/rmuir/elasticsearch/forks","keys_url":"https://api.github.com/repos/rmuir/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rmuir/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rmuir/elasticsearch/teams","hooks_url":"https://api.github.com/repos/rmuir/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/rmuir/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/rmuir/elasticsearch/events","assignees_url":"https://api.github.com/repos/rmuir/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/rmuir/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/rmuir/elasticsearch/tags","blobs_url":"https://api.github.com/repos/rmuir/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rmuir/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rmuir/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/rmuir/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rmuir/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/rmuir/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/rmuir/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/rmuir/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/rmuir/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/rmuir/elasticsearch/subscription","commits_url":"https://api.github.com/repos/rmuir/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/rmuir/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/rmuir/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/rmuir/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/rmuir/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/rmuir/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rmuir/elasticsearch/merges","archive_url":"https://api.github.com/repos/rmuir/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rmuir/elasticsearch/downloads","issues_url":"https://api.github.com/repos/rmuir/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/rmuir/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/rmuir/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/rmuir/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rmuir/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/rmuir/elasticsearch/releases{/id}","created_at":"2014-03-17T10:46:33Z","updated_at":"2015-04-20T21:27:40Z","pushed_at":"2015-04-24T22:38:18Z","git_url":"git://github.com/rmuir/elasticsearch.git","ssh_url":"git@github.com:rmuir/elasticsearch.git","clone_url":"https://github.com/rmuir/elasticsearch.git","svn_url":"https://github.com/rmuir/elasticsearch","homepage":"http://elasticsearch.org","size":110112,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"48388dbb6ec66a60bc150a9357d7c6b8bc7bc54e","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":507775,"name":"elasticsearch","full_name":"elastic/elasticsearch","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":false,"url":"https://api.github.com/repos/elastic/elasticsearch","forks_url":"https://api.github.com/repos/elastic/elasticsearch/forks","keys_url":"https://api.github.com/repos/elastic/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/elasticsearch/teams","hooks_url":"https://api.github.com/repos/elastic/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/elasticsearch/events","assignees_url":"https://api.github.com/repos/elastic/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/elasticsearch/tags","blobs_url":"https://api.github.com/repos/elastic/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/elastic/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/elastic/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/elastic/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/elastic/elasticsearch/subscription","commits_url":"https://api.github.com/repos/elastic/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/elasticsearch/merges","archive_url":"https://api.github.com/repos/elastic/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/elasticsearch/downloads","issues_url":"https://api.github.com/repos/elastic/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/elastic/elasticsearch/releases{/id}","created_at":"2010-02-08T13:20:56Z","updated_at":"2015-04-25T20:01:44Z","pushed_at":"2015-04-25T19:17:39Z","git_url":"git://github.com/elastic/elasticsearch.git","ssh_url":"git@github.com:elastic/elasticsearch.git","clone_url":"https://github.com/elastic/elasticsearch.git","svn_url":"https://github.com/elastic/elasticsearch","homepage":"http://elasticsearch.org","size":338507,"stargazers_count":10938,"watchers_count":10938,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3440,"mirror_url":null,"open_issues_count":1120,"forks":3440,"open_issues":1120,"watchers":10938,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10174"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/10174"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/10174"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/10174/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10174/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10174/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/8924739e1ad5c7c9765ef190d011d8561ef3dfab"}}}}