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

Give an example of a single line Hash. #9505

Merged
merged 2 commits into from May 2, 2018
Merged

Conversation

webmat
Copy link
Contributor

@webmat webmat commented May 1, 2018

Single kv hashes look like Ruby hashes, and people get confused.
Let's make the example more explicit.

Single kv hashes look like Ruby hashes, and people get confused. Let's make the example more explicit.
@@ -188,6 +188,8 @@ match => {
"field2" => "value2"
...
}
# or
match => { "field1" => "value1" "field2" => "value2" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, what about spreading this on multiple lines to (hopefully) improve readability?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of this addition is to clearly show how to do single line hashes. It gets people confused.

I agree that multi-line is clearer. But sometimes you just have 2 key-values, and the syntax that looks like Ruby hashes confuses people. They wonder why { "field1" => "value1", "field2" => "value2" } doesn't work.

That's also why I put the single line example just below the multi-line example. To convey that multi-line should be the first option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh thanks for the explanation. My preference to avoid this in-line style blinded me to your goal.

Small suggestion, change # or to # or as a single line. No commas between entries:

@jordansissel
Copy link
Contributor

Left a final small comment, and I leave it up to you which path to take (change the comment or not). Either way, LGTM.

@webmat webmat added the docs label May 2, 2018
@webmat webmat self-assigned this May 2, 2018
@webmat webmat merged commit ce0cc8c into elastic:master May 2, 2018
@webmat webmat deleted the hash-example2 branch May 2, 2018 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants