Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with diff #77

Open
cdenneen opened this issue Feb 12, 2020 · 0 comments
Open

Issues with diff #77

cdenneen opened this issue Feb 12, 2020 · 0 comments

Comments

@cdenneen
Copy link

Tried with 1.0.0 release and below is against master branch:

script

require 'awesome_print'
require 'hashdiff'
a = {"order"=>1, "index_patterns"=>["logstash-cloudtrail*"], "settings"=>{"index"=>{"lifecycle"=>{"name"=>"logging_policy", "rollover_alias"=>"logstash-cloudtrail-write"}, "routing"=>{"allocation"=>{"require"=>{"node_type"=>"hot"}}}, "mapping"=>{"total_fields"=>{"limit"=>8000}, "ignore_malformed"=>"true"}, "refresh_interval"=>"30s", "number_of_shards"=>2, "merge"=>{"scheduler"=>{"max_thread_count"=>1}}, "number_of_replicas"=>2}}, "mappings"=>{"_doc"=>{"dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "mapping"=>{"norms"=>false, "type"=>"text"}, "match_mapping_type"=>"string"}}, {"string_fields"=>{"mapping"=>{"norms"=>false, "type"=>"text", "fields"=>{"keyword"=>{"ignore_above"=>256, "type"=>"keyword"}}}, "match_mapping_type"=>"string", "match"=>"*"}}], "properties"=>{"@timestamp"=>{"type"=>"date"}, "@version"=>{"type"=>"keyword"}}}}, "aliases"=>{"all_logs"=>{}}}

b = {"order"=>1, "aliases"=>{"all_logs"=>{}}, "mappings"=>{"_doc"=>{"dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"norms"=>false, "type"=>"text"}}}, {"string_fields"=>{"match"=>"*", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date"}, "@version"=>{"type"=>"keyword"}}}}, "index_patterns"=>["logstash-cloudtrail*"], "settings"=>{"index"=>{"mapping.total_fields.limit"=>8000, "mapping.ignore_malformed"=>true, "routing.allocation.require.node_type"=>"hot", "refresh_interval"=>"30s", "merge.scheduler.max_thread_count"=>1, "number_of_replicas"=>2, "number_of_shards"=>2, "lifecycle.rollover_alias"=>"logstash-cloudtrail-write", "lifecycle.name"=>"logging_policy"}}}
ap Hashdiff.diff(a,b)

result

[
  [0] [
    [0] "-",
    [1] "settings.index.lifecycle",
    [2] {
                "name" => "logging_policy",
      "rollover_alias" => "logstash-cloudtrail-write"
    }
  ],
  [1] [
    [0] "-",
    [1] "settings.index.mapping",
    [2] {
      "ignore_malformed" => "true",
          "total_fields" => {
        "limit" => 8000
      }
    }
  ],
  [2] [
    [0] "-",
    [1] "settings.index.merge",
    [2] {
      "scheduler" => {
        "max_thread_count" => 1
      }
    }
  ],
  [3] [
    [0] "-",
    [1] "settings.index.routing",
    [2] {
      "allocation" => {
        "require" => {
          "node_type" => "hot"
        }
      }
    }
  ],
  [4] [
    [0] "+",
    [1] "settings.index.lifecycle.name",
    [2] "logging_policy"
  ],
  [5] [
    [0] "+",
    [1] "settings.index.lifecycle.rollover_alias",
    [2] "logstash-cloudtrail-write"
  ],
  [6] [
    [0] "+",
    [1] "settings.index.mapping.ignore_malformed",
    [2] true
  ],
  [7] [
    [0] "+",
    [1] "settings.index.mapping.total_fields.limit",
    [2] 8000
  ],
  [8] [
    [0] "+",
    [1] "settings.index.merge.scheduler.max_thread_count",
    [2] 1
  ],
  [9] [
    [0] "+",
    [1] "settings.index.routing.allocation.require.node_type",
    [2] "hot"
  ]
]

If you look at the source the true is already a Boolean so not sure why the diff for ignore_malformed shows a "true" to true.
The rest of the diff appears to be exactly the same so not sure why this is causing a diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant