Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Add RFC for Rest API as commands. #42

Merged
merged 2 commits into from
Feb 12, 2021

Conversation

VijayanB
Copy link
Member

Added rfc for rest api as commands

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@VijayanB VijayanB added the Documentation Improvements or additions to documentation label Feb 10, 2021
@VijayanB VijayanB self-assigned this Feb 10, 2021
@codecov
Copy link

codecov bot commented Feb 10, 2021

Codecov Report

Merging #42 (14bc15a) into main (b1c86fe) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #42   +/-   ##
=======================================
  Coverage   65.33%   65.33%           
=======================================
  Files          20       20           
  Lines        1255     1255           
=======================================
  Hits          820      820           
  Misses        341      341           
  Partials       94       94           
Flag Coverage Δ
odfe-cli 65.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

## Objective

This document describes how to support [rest api](https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html) in a generic way.
As of now, elasticsearch support api in different categories like index api, cat api, cluster api, document api, etc to
Copy link
Member

Choose a reason for hiding this comment

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

Capitalize "e" in elasticsearch.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack

This document describes how to support [rest api](https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html) in a generic way.
As of now, elasticsearch support api in different categories like index api, cat api, cluster api, document api, etc to
configure and access their features. It will take tremendous amount of time and effort to provide every api as native commands.
Hence, we will be categorizing those REST API based on GET/PUT/POST/DELETE and allow users to perform their request
Copy link
Member

Choose a reason for hiding this comment

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

We should be consistent in capitalization of "rest" and "api"

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack

Copy link
Member

Choose a reason for hiding this comment

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

I still see some incosistencies where there is "api" and "API"

As of now, elasticsearch support api in different categories like index api, cat api, cluster api, document api, etc to
configure and access their features. It will take tremendous amount of time and effort to provide every api as native commands.
Hence, we will be categorizing those REST API based on GET/PUT/POST/DELETE and allow users to perform their request
in a generic way. This will support any future API without any additional support. It also benefits plugin owners while on-boarding their plugin.
Copy link
Member

Choose a reason for hiding this comment

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

Benefitting plugin owners isn't exactly clear to me. How will this change anything?

Copy link
Member Author

@VijayanB VijayanB Feb 10, 2021

Choose a reason for hiding this comment

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

So right now, plug in owners has to build the gateway layer by using framework methods like build request/ call request. Now, they can call ES's controller methods(get/put/post) directly .

Copy link
Member

Choose a reason for hiding this comment

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

Can you add that explanation here?

Copy link
Member Author

Choose a reason for hiding this comment

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

on second thought, removed this point. I will update our developer guideline to include this benefit once i merge this feature, since we need to provide a new direction on how to use this in framework. I am planning to keep those discussion away from this feature at this point.


## Common parameters

The following options can be applied to all of the odfe-cli commands. These parameters are supported by server as mentioned [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html).
Copy link
Member

Choose a reason for hiding this comment

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

What do you mean "supported by server"?

Copy link
Member Author

Choose a reason for hiding this comment

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

i was trying to distant our cli with elasticsearch as much as possible. May be it is confusing. Let me revert back to call elasticsearch to avoid this confusion.

## Common parameters

The following options can be applied to all of the odfe-cli commands. These parameters are supported by server as mentioned [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html).
In future more parameters or include multiple values will be supported that can be added as flag to any commands.
Copy link
Member

Choose a reason for hiding this comment

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

"In the future, we will support ..."

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack

docs/dev/rfc/odfe-cli-rest-api-as-commands.md Show resolved Hide resolved

### Description

Use GET API to execute requests against elasticsearch cluster. This command enables you to run any GET based REST API commands across all
Copy link
Member

Choose a reason for hiding this comment

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

Capitalize elasticsearch

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack

2. To returns the health status of a cluster.

```
odfe-cli cmd get --path "_cluster/health" --pretty
Copy link
Member

Choose a reason for hiding this comment

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

I like curl instead of cmd

Copy link
Member Author

Choose a reason for hiding this comment

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

sure. That is one of the question in RFC. If we don't get any response, i was thinking of posting on es-learning group to get vote!

docs/dev/rfc/odfe-cli-rest-api-as-commands.md Show resolved Hide resolved
This document describes how to support [rest api](https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html) in a generic way.
As of now, elasticsearch support api in different categories like index api, cat api, cluster api, document api, etc to
configure and access their features. It will take tremendous amount of time and effort to provide every api as native commands.
Hence, we will be categorizing those REST API based on GET/PUT/POST/DELETE and allow users to perform their request
Copy link
Member

Choose a reason for hiding this comment

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

I still see some incosistencies where there is "api" and "API"

As of now, elasticsearch support api in different categories like index api, cat api, cluster api, document api, etc to
configure and access their features. It will take tremendous amount of time and effort to provide every api as native commands.
Hence, we will be categorizing those REST API based on GET/PUT/POST/DELETE and allow users to perform their request
in a generic way. This will support any future API without any additional support. It also benefits plugin owners while on-boarding their plugin.
Copy link
Member

Choose a reason for hiding this comment

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

Can you add that explanation here?

docs/dev/rfc/odfe-cli-rest-api-as-commands.md Show resolved Hide resolved
epoch timestamp count
1612311592 12:24:24 100
```
2. To returns the health status of a cluster.
Copy link
Member

Choose a reason for hiding this comment

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

return not returns. Remove period at end of line.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack

docs/dev/rfc/odfe-cli-rest-api-as-commands.md Show resolved Hide resolved
```
$ odfe-cli curl post --path "_search" \
--headers "Content-Encoding : gzip;Accept-Encoding: gzip, deflate" \
--data-bianry @/tmp/req.txt.gz`
Copy link
Member

Choose a reason for hiding this comment

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

binary misspelled

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack

Copy link
Member

@vamshin vamshin left a comment

Choose a reason for hiding this comment

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

LGTM! Looking forward to this feature :)

## Objective

This document describes how to support [rest api](https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html) in a generic way.
As of now, elasticsearch support api in different categories like index api, cat api, cluster api, document api, etc to
Copy link
Member

Choose a reason for hiding this comment

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

Minor elasticsearch -> Elasticsearch? In other places as well

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants