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

[DOCS] Rewrite get mapping API docs to use new format #44085

Closed
wants to merge 12 commits into from
Closed

[DOCS] Rewrite get mapping API docs to use new format #44085

wants to merge 12 commits into from

Conversation

jrodewig
Copy link
Contributor

@jrodewig jrodewig commented Jul 8, 2019

With elastic/docs#938, we created a standard template for Elastic API Reference documentation.

This PR rewrites the get mapping API to use that template.

Relates to elastic/docs#937

Before

Get mapping - Before get-mapping-before

After

Get mapping - After get-mapping-before

@jrodewig jrodewig added >docs General docs changes :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0 v7.0.2 v7.3.0 v7.1.2 v7.2.1 v7.4.0 labels Jul 8, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

@jrodewig jrodewig changed the title [DOCS] Rewrite get mapping API docs to use new API reference format [DOCS] Rewrite get mapping API docs to use new format Jul 9, 2019
Copy link
Contributor

@jtibshirani jtibshirani left a comment

Choose a reason for hiding this comment

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

Hopefully I didn't jump in too early if you weren't yet looking for a review, this PR just caught my eye.

I left a few comments, and also had one overall thought. Since these pages serve as the main API reference, I think many users consult them to get a quick idea/ refresher of what an API is about, and to look for a snippet to copy-and-paste. For that reason I wonder if it would be best to keep the 'example' section near the top. This would help maintain support for the most common 'use-cases' of these docs -- in the new format a user needs to scroll past a detailed list query + request parameters, many of which are quite rare to use.


The get mapping API allows to retrieve mapping definitions for an index or
index/type.
Returns field mapping information for an index.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be nice to continue to refer to 'mapping definitions' as opposed to 'field mapping information', since this API returns more than just field mappings (for example dynamic_templates).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great point! Changed with 0f50a5a.

(boolean) Indicates whether the type name is included in the response. Defaults
to `false`.

NOTE: Before 7.0.0, the 'mappings' definition used to include a type name.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's important for this note to remain near the top of the page. In 7.0 we removed types from all APIs, which was a breaking change to several core, long-standing APIs. Having the note at the top of the page allows users to quickly debug the situation once they run into the change -- I'm not sure most users will benefit from the note when it's in this subsection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree. Fixed with 0d55000.

[[indices-get-mapping-query-params]]
=== {api-query-parms-title}

`allow_no_indices` (Optional)::
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we link to the documentation on multiple indices (https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html), instead of repeating this information in every API reference?

Copy link
Contributor Author

@jrodewig jrodewig Jul 10, 2019

Choose a reason for hiding this comment

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

I think there is some value in listing the parameters here rather than directing people to a separate page.

As a compromise, I moved these parameters to a separate file and included them with
f676309. That way we can edit and reuse them from a single source but still make the content available everywhere.

Let me know if you think that works. I can also add an indicator that this is a rarely used or expert parameter if wanted.

Copy link
Contributor

Choose a reason for hiding this comment

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

That seems like a good compromise to me, it will make the information easier to keep in sync.

NOTE: Before 7.0.0, the 'mappings' definition used to include a type name. Although mappings
in responses no longer contain a type name by default, you can still request the old format
through the parameter include_type_name. For more details, please see <<removal-of-types>>.
`GET /<index>/_mapping`
Copy link
Contributor

Choose a reason for hiding this comment

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

In other documentation and technical communication, I've seen the style GET /{index}/_mapping. I haven't really seen us use angle brackets (a quick code search through *.asciidoc files confirms this trend).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done with 4e01d52. This will also match the current rest spec.

@jrodewig
Copy link
Contributor Author

Thanks so much for your review @jjtibshirani. This is a beta/pilot of a new API reference template the writers are working on. I'll incorporate some changes there based on your feedback.

I've moved the current example higher on the page to better enable grab-and-go for users just looking for a quick example. Let me know if you feel other examples (multiple/all indices) would also be helpful here.

Copy link
Contributor

@jtibshirani jtibshirani left a comment

Choose a reason for hiding this comment

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

Thanks for making all those changes!

Related to the placement of 'examples' -- to me it'd be more natural if the description came before the example, so it's not coming with no context. In fact, I'm wondering why there are two separate areas for a short description? Our current API documentation very often begins with a paragraph description that incorporates a simple example in-line. I think this reads nicely and puts the most helpful information up-front.

@jrodewig jrodewig added the WIP label Jul 11, 2019
@jrodewig
Copy link
Contributor Author

jrodewig commented Jul 11, 2019

@jtibshirani Thank you again.

I agree that the two descriptions now seem a bit much. I'll plan to talk this over with some of the other writers working on theAPI reference template and see if we can better incorporate those sections.

In the meantime, I'm marking this and any PRs related to #43765 as a WIP. I won't merge these PRs until I've had a chance to let others review the template.

@jtibshirani
Copy link
Contributor

@jrodewig thanks, marking them as WIP helps clarify the intention that this is a 'test drive' of the new template.

@jpountz jpountz removed the v7.3.0 label Jul 26, 2019
@jrodewig
Copy link
Contributor Author

jrodewig commented Aug 1, 2019

Gonna close this for now. May re-open at a later date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>docs General docs changes :Search Foundations/Mapping Index mappings, including merging and defining field types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants