From 67e024d79081422ac2f014b3e5325463c52160d4 Mon Sep 17 00:00:00 2001 From: Oliver Eilhard Date: Sat, 19 Mar 2022 08:54:18 +0100 Subject: [PATCH] Make SeqNoAndPrimaryTerm the preferred function Mark `SeqNoPrimaryTerm` as deprecated and make people use `SeqNoAndPrimaryTerm` instead. It's the preferred naming in Elasticsearch. Notice however that on the wire we still have `seq_no_primary_term`, see https://github.com/elastic/elasticsearch/blob/ed5fc8bdb343fa27a23ccb2b91d6bf6bd28cc999/server/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java#L83. Close #1593 --- search.go | 11 +++++++++-- xpack_async_search_submit.go | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/search.go b/search.go index 2be5517f8..ed76466cb 100644 --- a/search.go +++ b/search.go @@ -458,9 +458,16 @@ func (s *SearchService) TypedKeys(enabled bool) *SearchService { return s } -// SeqNoPrimaryTerm specifies whether to return sequence number and -// primary term of the last modification of each hit. +// SeqNoPrimaryTerm is an alias for SeqNoAndPrimaryTerm. +// +// Deprecated: Use SeqNoAndPrimaryTerm. func (s *SearchService) SeqNoPrimaryTerm(enabled bool) *SearchService { + return s.SeqNoAndPrimaryTerm(enabled) +} + +// SeqNoAndPrimaryTerm specifies whether to return sequence number and +// primary term of the last modification of each hit. +func (s *SearchService) SeqNoAndPrimaryTerm(enabled bool) *SearchService { s.seqNoPrimaryTerm = &enabled return s } diff --git a/xpack_async_search_submit.go b/xpack_async_search_submit.go index f2c13b69d..11ece6857 100644 --- a/xpack_async_search_submit.go +++ b/xpack_async_search_submit.go @@ -453,9 +453,16 @@ func (s *XPackAsyncSearchSubmit) TypedKeys(enabled bool) *XPackAsyncSearchSubmit return s } -// SeqNoPrimaryTerm specifies whether to return sequence number and -// primary term of the last modification of each hit. +// SeqNoPrimaryTerm is an alias for SeqNoAndPrimaryTerm. +// +// Deprecated: Use SeqNoAndPrimaryTerm instead. func (s *XPackAsyncSearchSubmit) SeqNoPrimaryTerm(enabled bool) *XPackAsyncSearchSubmit { + return s.SeqNoAndPrimaryTerm(enabled) +} + +// SeqNoAndPrimaryTerm specifies whether to return sequence number and +// primary term of the last modification of each hit. +func (s *XPackAsyncSearchSubmit) SeqNoAndPrimaryTerm(enabled bool) *XPackAsyncSearchSubmit { s.seqNoPrimaryTerm = &enabled return s }