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

Added FilterPath param #673

Merged
merged 2 commits into from
Feb 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Dependencies
### Added
- Adds `InnerHits` field to `SearchResp` ([#672](https://github.com/opensearch-project/opensearch-go/pull/672))
- Adds `FilterPath` param ([#673](https://github.com/opensearch-project/opensearch-go/pull/673))

### Changed
### Deprecated
Expand Down
10 changes: 9 additions & 1 deletion opensearchapi/api_aliases-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@

package opensearchapi

import "time"
import (
"strings"
"time"
)

// AliasesParams represents possible parameters for the AliasesReq
type AliasesParams struct {
Expand All @@ -37,6 +40,7 @@ type AliasesParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r AliasesParams) get() map[string]string {
Expand Down Expand Up @@ -66,5 +70,9 @@ func (r AliasesParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

return params
}
5 changes: 5 additions & 0 deletions opensearchapi/api_bulk-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type BulkParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r BulkParams) get() map[string]string {
Expand Down Expand Up @@ -109,5 +110,9 @@ func (r BulkParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

return params
}
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-aliases-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type CatAliasesParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatAliasesParams) get() map[string]string {
Expand Down Expand Up @@ -79,6 +80,10 @@ func (r CatAliasesParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-allocation-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type CatAllocationParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatAllocationParams) get() map[string]string {
Expand Down Expand Up @@ -95,6 +96,10 @@ func (r CatAllocationParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-cluster_manager-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type CatClusterManagerParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatClusterManagerParams) get() map[string]string {
Expand Down Expand Up @@ -85,6 +86,10 @@ func (r CatClusterManagerParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-count-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type CatCountParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatCountParams) get() map[string]string {
Expand Down Expand Up @@ -69,6 +70,10 @@ func (r CatCountParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-fielddata-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type CatFieldDataParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatFieldDataParams) get() map[string]string {
Expand Down Expand Up @@ -74,6 +75,10 @@ func (r CatFieldDataParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-health-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type CatHealthParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatHealthParams) get() map[string]string {
Expand Down Expand Up @@ -79,6 +80,10 @@ func (r CatHealthParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-indices-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type CatIndicesParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatIndicesParams) get() map[string]string {
Expand Down Expand Up @@ -115,6 +116,10 @@ func (r CatIndicesParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-master-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type CatMasterParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatMasterParams) get() map[string]string {
Expand Down Expand Up @@ -85,6 +86,10 @@ func (r CatMasterParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-nodeattrs-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type CatNodeAttrsParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatNodeAttrsParams) get() map[string]string {
Expand Down Expand Up @@ -85,6 +86,10 @@ func (r CatNodeAttrsParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-nodes-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type CatNodesParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatNodesParams) get() map[string]string {
Expand Down Expand Up @@ -105,6 +106,10 @@ func (r CatNodesParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-pending_tasks-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type CatPendingTasksParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatPendingTasksParams) get() map[string]string {
Expand Down Expand Up @@ -90,6 +91,10 @@ func (r CatPendingTasksParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-plugins-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type CatPluginsParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatPluginsParams) get() map[string]string {
Expand Down Expand Up @@ -85,6 +86,10 @@ func (r CatPluginsParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-recovery-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type CatRecoveryParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatRecoveryParams) get() map[string]string {
Expand Down Expand Up @@ -89,6 +90,10 @@ func (r CatRecoveryParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-repositories-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type CatRepositoriesParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatRepositoriesParams) get() map[string]string {
Expand Down Expand Up @@ -85,6 +86,10 @@ func (r CatRepositoriesParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-segments-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type CatSegmentsParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatSegmentsParams) get() map[string]string {
Expand Down Expand Up @@ -90,6 +91,10 @@ func (r CatSegmentsParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-shards-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type CatShardsParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatShardsParams) get() map[string]string {
Expand Down Expand Up @@ -95,6 +96,10 @@ func (r CatShardsParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-snapshots-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type CatSnapshotsParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatSnapshotsParams) get() map[string]string {
Expand Down Expand Up @@ -90,6 +91,10 @@ func (r CatSnapshotsParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
5 changes: 5 additions & 0 deletions opensearchapi/api_cat-tasks-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type CatTasksParams struct {
Pretty bool
Human bool
ErrorTrace bool
FilterPath []string
}

func (r CatTasksParams) get() map[string]string {
Expand Down Expand Up @@ -99,6 +100,10 @@ func (r CatTasksParams) get() map[string]string {
params["error_trace"] = "true"
}

if len(r.FilterPath) > 0 {
params["filter_path"] = strings.Join(r.FilterPath, ",")
}

params["format"] = "json"

return params
Expand Down
Loading
Loading