From a350549ead4697bcdb5f74b9ba4c28274fb78a4f Mon Sep 17 00:00:00 2001 From: wubin <328454505@qq.com> Date: Tue, 14 Jun 2022 17:27:38 +0800 Subject: [PATCH] add include_type_name to GetMapping api --- indices_get_mapping.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/indices_get_mapping.go b/indices_get_mapping.go index 352016342..0f448401b 100644 --- a/indices_get_mapping.go +++ b/indices_get_mapping.go @@ -34,6 +34,7 @@ type IndicesGetMappingService struct { ignoreUnavailable *bool allowNoIndices *bool expandWildcards string + includeTypeName *bool } // NewGetMappingService is an alias for NewIndicesGetMappingService. @@ -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 { @@ -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 }