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 include_type_name to GetMapping api #1621

Open
wants to merge 1 commit into
base: release-branch.v7
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions indices_get_mapping.go
Expand Up @@ -34,6 +34,7 @@ type IndicesGetMappingService struct {
ignoreUnavailable *bool
allowNoIndices *bool
expandWildcards string
includeTypeName *bool
}

// NewGetMappingService is an alias for NewIndicesGetMappingService.
Expand Down Expand Up @@ -118,6 +119,13 @@ func (s *IndicesGetMappingService) ExpandWildcards(expandWildcards string) *Indi
return s
}

// IncludeTypeName indicates whether to expect a mapping type.
// If true, a mapping type is expected in the body of mappings. Defaults to false.
func (s *IndicesGetMappingService) IncludeTypeName(includeTypeName bool) *IndicesGetMappingService {
s.includeTypeName = &includeTypeName
return s
}

// Local indicates whether to return local information, do not retrieve
// the state from master node (default: false).
func (s *IndicesGetMappingService) Local(local bool) *IndicesGetMappingService {
Expand Down Expand Up @@ -183,6 +191,9 @@ func (s *IndicesGetMappingService) buildURL() (string, url.Values, error) {
if s.local != nil {
params.Set("local", fmt.Sprintf("%v", *s.local))
}
if s.includeTypeName != nil {
params.Set("include_type_name", fmt.Sprintf("%v", *s.includeTypeName))
}
return path, params, nil
}

Expand Down