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

Add new component template APIs #1458

Merged
merged 1 commit into from Jun 16, 2021

Conversation

@yann-soubeyrand
Copy link
Contributor

@yann-soubeyrand yann-soubeyrand commented Feb 3, 2021

This is an attempt to add the new component template APIs based on the code for the new index template APIs.

ShardsAcknowledged bool `json:"shards_acknowledged"`
Index string `json:"index,omitempty"`
Copy link
Contributor Author

@yann-soubeyrand yann-soubeyrand Feb 3, 2021

Choose a reason for hiding this comment

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

I copied this from indices_delete_index_template.go but I didn't know where to check if these fields can appear in a response (they don't when I do a simple request to the API).

Loading

Copy link

@ghost ghost Feb 17, 2021

Choose a reason for hiding this comment

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

I guess only theacknowledged field is filled here, since we do not change something on indices here

Loading

ShardsAcknowledged bool `json:"shards_acknowledged"`
Index string `json:"index,omitempty"`
Copy link
Contributor Author

@yann-soubeyrand yann-soubeyrand Feb 3, 2021

Choose a reason for hiding this comment

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

Same comment as above.

Loading

Copy link

@ghost ghost Feb 17, 2021

Choose a reason for hiding this comment

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

see above

Loading

This commit implements the new Component Template APIs which come with the new
Index Template APIs as described in
https://www.elastic.co/guide/en/elasticsearch/reference/7.9/index-templates.html.

Close olivere#1414

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>
@ghost
Copy link

@ghost ghost commented Feb 17, 2021

@olivere This would be a really nice feature for the terraform provider, could you take a look on this PR, please :)

Loading

}
}

// Get the component template
Copy link

@ghost ghost Feb 17, 2021

Choose a reason for hiding this comment

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

A Test Case for a missing template would be nice :)

Loading

ShardsAcknowledged bool `json:"shards_acknowledged"`
Index string `json:"index,omitempty"`
Copy link

@ghost ghost Feb 17, 2021

Choose a reason for hiding this comment

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

I guess only theacknowledged field is filled here, since we do not change something on indices here

Loading

ShardsAcknowledged bool `json:"shards_acknowledged"`
Index string `json:"index,omitempty"`
Copy link

@ghost ghost Feb 17, 2021

Choose a reason for hiding this comment

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

see above

Loading

@phillbaker
Copy link
Contributor

@phillbaker phillbaker commented Mar 5, 2021

@olivere any thoughts on this?

Loading

@olivere
Copy link
Owner

@olivere olivere commented Mar 6, 2021

This is looking really good. Thank you for working on it.

Did you check that the request parameters are the ones specified by the REST API? I've seen that contributors often start by copying an existing service but then leave a lot of fields that are actually not allowed for the new service, or miss some that are. It's pretty hard to figure out because some fields are allowed on every service, and are still not specified in the REST API spec for that specific service.

It's also worth checking the Java code as the ultimate source of truth, when in doubt. E.g. those toXContent methods describe how ES serializes the JSON—documentation, while really good, is not enough in many cases.

Loading

@yann-soubeyrand
Copy link
Contributor Author

@yann-soubeyrand yann-soubeyrand commented May 17, 2021

Hi @olivere, sorry for the delayed answer… I think I did some mistakes on the parameters, since, as you mentioned, it’s hard to find the ultimate source of truth.

I’m wondering what’s the status of this project compared to the official Go client for Elasticsearch (https://github.com/elastic/go-elasticsearch)?

Loading

@olivere
Copy link
Owner

@olivere olivere commented May 17, 2021

Hi @yann-soubeyrand! The source of trust the the REST API spec. However, they don't spec out the body of the request/response. That's when I look into the Java source. Those (from|to)XContent methods in the .*Builder classes are a safe bet.

With regards to the official Elasticsearch client, I've pinned an issue with my perspective on that. See here.

Loading

@olivere olivere added this to the 7.0.25 milestone Jun 16, 2021
@olivere olivere merged commit 37e6bfd into olivere:release-branch.v7 Jun 16, 2021
5 checks passed
Loading
dungnx pushed a commit to dungnx/elastic that referenced this issue Sep 16, 2021
This commit implements the Component Template APIs which come with the new
Index Template APIs as described in
https://www.elastic.co/guide/en/elasticsearch/reference/7.9/index-templates.html.

Close olivere#1414
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants