{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/32870548","id":32870548,"diff_hunk":"@@ -225,6 +226,68 @@ public int hashCode() {\n \n // norelease: we need to override freeze() and add safety checks that all settings are actually set\n \n+    /**\n+     * Checks for any conflicts between this field type and other.\n+     */\n+    public void validateCompatible(MappedFieldType other, List<String> conflicts) {\n+        boolean indexed =  indexOptions() != IndexOptions.NONE;\n+        boolean mergeWithIndexed = other.indexOptions() != IndexOptions.NONE;\n+        if (indexed != mergeWithIndexed || tokenized() != other.tokenized()) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different index values\");\n+        }\n+        if (stored() != other.stored()) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different store values\");\n+        }\n+        if (hasDocValues() == false && other.hasDocValues()) {\n+            // don't add conflict if this mapper has doc values while the mapper to merge doesn't since doc values are implicitely set\n+            // when the doc_values field data format is configured\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different doc_values values\");\n+        }\n+        if (omitNorms() && !other.omitNorms()) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] cannot enable norms (`norms.enabled`)\");\n+        }\n+        if (tokenized() != other.tokenized()) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different tokenize values\");\n+        }\n+        if (storeTermVectors() != other.storeTermVectors()) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different store_term_vector values\");\n+        }\n+        if (storeTermVectorOffsets() != other.storeTermVectorOffsets()) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different store_term_vector_offsets values\");\n+        }\n+        if (storeTermVectorPositions() != other.storeTermVectorPositions()) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different store_term_vector_positions values\");\n+        }\n+        if (storeTermVectorPayloads() != other.storeTermVectorPayloads()) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different store_term_vector_payloads values\");\n+        }\n+\n+        // null and \"default\"-named index analyzers both mean the default is used\n+        if (indexAnalyzer() == null || \"default\".equals(indexAnalyzer().name())) {\n+            if (other.indexAnalyzer() != null && \"default\".equals(other.indexAnalyzer().name()) == false) {\n+                conflicts.add(\"mapper [\" + names().fullName() + \"] has different analyzer\");\n+            }\n+        } else if (other.indexAnalyzer() == null || \"default\".equals(other.indexAnalyzer().name())) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different analyzer\");\n+        } else if (indexAnalyzer().name().equals(other.indexAnalyzer().name()) == false) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different analyzer\");\n+        }\n+\n+        if (!names().equals(other.names())) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different index_name\");\n+        }\n+\n+        if (similarity() == null) {\n+            if (other.similarity() != null) {\n+                conflicts.add(\"mapper [\" + names().fullName() + \"] has different similarity\");\n+            }\n+        } else if (other.similarity() == null) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different similarity\");\n+        } else if (!similarity().equals(other.similarity())) {\n+            conflicts.add(\"mapper [\" + names().fullName() + \"] has different similarity\");\n+        }","path":"core/src/main/java/org/elasticsearch/index/mapper/MappedFieldType.java","position":71,"original_position":71,"commit_id":"434b1c94b38bd82d70dadd7095be6a732f37946f","original_commit_id":"434b1c94b38bd82d70dadd7095be6a732f37946f","user":{"login":"jpountz","id":299848,"avatar_url":"https://avatars.githubusercontent.com/u/299848?v=3","gravatar_id":"","url":"https://api.github.com/users/jpountz","html_url":"https://github.com/jpountz","followers_url":"https://api.github.com/users/jpountz/followers","following_url":"https://api.github.com/users/jpountz/following{/other_user}","gists_url":"https://api.github.com/users/jpountz/gists{/gist_id}","starred_url":"https://api.github.com/users/jpountz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpountz/subscriptions","organizations_url":"https://api.github.com/users/jpountz/orgs","repos_url":"https://api.github.com/users/jpountz/repos","events_url":"https://api.github.com/users/jpountz/events{/privacy}","received_events_url":"https://api.github.com/users/jpountz/received_events","type":"User","site_admin":false},"body":"or just:\r\n```java\r\nif (Objects.equals(similarity(), other.similarity() == false) {\r\n  conflicts.add(\"mapper [\" + names().fullName() + \"] has different similarity\");\r\n}\r\n```","created_at":"2015-06-19T21:22:28Z","updated_at":"2015-06-19T21:22:28Z","html_url":"https://github.com/elastic/elasticsearch/pull/11783#discussion_r32870548","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11783","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/32870548"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/11783#discussion_r32870548"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11783"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11783","id":38146392,"html_url":"https://github.com/elastic/elasticsearch/pull/11783","diff_url":"https://github.com/elastic/elasticsearch/pull/11783.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/11783.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/11783","number":11783,"state":"open","locked":false,"title":"Move merge simulation of fieldtype settings to fieldtype method","user":{"login":"rjernst","id":289412,"avatar_url":"https://avatars.githubusercontent.com/u/289412?v=3","gravatar_id":"","url":"https://api.github.com/users/rjernst","html_url":"https://github.com/rjernst","followers_url":"https://api.github.com/users/rjernst/followers","following_url":"https://api.github.com/users/rjernst/following{/other_user}","gists_url":"https://api.github.com/users/rjernst/gists{/gist_id}","starred_url":"https://api.github.com/users/rjernst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjernst/subscriptions","organizations_url":"https://api.github.com/users/rjernst/orgs","repos_url":"https://api.github.com/users/rjernst/repos","events_url":"https://api.github.com/users/rjernst/events{/privacy}","received_events_url":"https://api.github.com/users/rjernst/received_events","type":"User","site_admin":false},"body":"For #8871, we need to be able to check field types are compatible,\r\nwithout comparing FieldMappers.  This change moves the simulation\r\nchecks (which generate merge conflicts) for any properties of\r\nMappedFieldTypes into a new method, validateCompatible.\r\n\r\nThis also simplifies the merge code which merges settings\r\nbetween the old and new fieldtypes. Previously, each subclass\r\nof FieldMapper would have to set its own fieldtype settings.\r\nHowever, now that we have .clone(), which perfectly copies\r\nall properties (with subclasses accounted for), we can now\r\ndo a simple clone when merging.\r\n\r\nFinally, this fixes a subtle bug in merging, in which if\r\nmerging has conflicts, and we were not simulating, we would\r\nstill update the field type, even though it was not compatible!\r\n\r\nNOTE: there is one test failure I am trying to track down with\r\ntimestamp merging. Otherwise, all tests pass.","created_at":"2015-06-19T20:48:10Z","updated_at":"2015-06-19T21:22:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3a39aa5d6a4ead75e8d192deaa270be6c10a565f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11783/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11783/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/11783/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/434b1c94b38bd82d70dadd7095be6a732f37946f","head":{"label":"rjernst:refactor/field-type-merge","ref":"refactor/field-type-merge","sha":"434b1c94b38bd82d70dadd7095be6a732f37946f","user":{"login":"rjernst","id":289412,"avatar_url":"https://avatars.githubusercontent.com/u/289412?v=3","gravatar_id":"","url":"https://api.github.com/users/rjernst","html_url":"https://github.com/rjernst","followers_url":"https://api.github.com/users/rjernst/followers","following_url":"https://api.github.com/users/rjernst/following{/other_user}","gists_url":"https://api.github.com/users/rjernst/gists{/gist_id}","starred_url":"https://api.github.com/users/rjernst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjernst/subscriptions","organizations_url":"https://api.github.com/users/rjernst/orgs","repos_url":"https://api.github.com/users/rjernst/repos","events_url":"https://api.github.com/users/rjernst/events{/privacy}","received_events_url":"https://api.github.com/users/rjernst/received_events","type":"User","site_admin":false},"repo":{"id":21088403,"name":"elasticsearch","full_name":"rjernst/elasticsearch","owner":{"login":"rjernst","id":289412,"avatar_url":"https://avatars.githubusercontent.com/u/289412?v=3","gravatar_id":"","url":"https://api.github.com/users/rjernst","html_url":"https://github.com/rjernst","followers_url":"https://api.github.com/users/rjernst/followers","following_url":"https://api.github.com/users/rjernst/following{/other_user}","gists_url":"https://api.github.com/users/rjernst/gists{/gist_id}","starred_url":"https://api.github.com/users/rjernst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjernst/subscriptions","organizations_url":"https://api.github.com/users/rjernst/orgs","repos_url":"https://api.github.com/users/rjernst/repos","events_url":"https://api.github.com/users/rjernst/events{/privacy}","received_events_url":"https://api.github.com/users/rjernst/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rjernst/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/rjernst/elasticsearch","forks_url":"https://api.github.com/repos/rjernst/elasticsearch/forks","keys_url":"https://api.github.com/repos/rjernst/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rjernst/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rjernst/elasticsearch/teams","hooks_url":"https://api.github.com/repos/rjernst/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/rjernst/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/rjernst/elasticsearch/events","assignees_url":"https://api.github.com/repos/rjernst/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/rjernst/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/rjernst/elasticsearch/tags","blobs_url":"https://api.github.com/repos/rjernst/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rjernst/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rjernst/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/rjernst/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rjernst/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/rjernst/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/rjernst/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/rjernst/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/rjernst/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/rjernst/elasticsearch/subscription","commits_url":"https://api.github.com/repos/rjernst/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/rjernst/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/rjernst/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/rjernst/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/rjernst/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/rjernst/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rjernst/elasticsearch/merges","archive_url":"https://api.github.com/repos/rjernst/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rjernst/elasticsearch/downloads","issues_url":"https://api.github.com/repos/rjernst/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/rjernst/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/rjernst/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/rjernst/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rjernst/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/rjernst/elasticsearch/releases{/id}","created_at":"2014-06-22T07:43:32Z","updated_at":"2014-10-12T08:10:41Z","pushed_at":"2015-06-19T20:47:11Z","git_url":"git://github.com/rjernst/elasticsearch.git","ssh_url":"git@github.com:rjernst/elasticsearch.git","clone_url":"https://github.com/rjernst/elasticsearch.git","svn_url":"https://github.com/rjernst/elasticsearch","homepage":"http://elasticsearch.org","size":139224,"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":"a8c2886b3fe525727e7af906c8a43bf9fa83b9b8","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-06-19T21:14:30Z","pushed_at":"2015-06-19T20:57:19Z","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":"https://www.elastic.co/products/elasticsearch","size":1894621,"stargazers_count":11697,"watchers_count":11697,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3702,"mirror_url":null,"open_issues_count":1135,"forks":3702,"open_issues":1135,"watchers":11697,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11783"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/11783"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/11783"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/11783/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11783/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11783/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/434b1c94b38bd82d70dadd7095be6a732f37946f"}}}}