Skip to content

Commit

Permalink
Make SeqNoAndPrimaryTerm the preferred function
Browse files Browse the repository at this point in the history
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
  • Loading branch information
olivere committed Mar 19, 2022
1 parent c2f1565 commit 67e024d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions search.go
Expand Up @@ -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
}
Expand Down
11 changes: 9 additions & 2 deletions xpack_async_search_submit.go
Expand Up @@ -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
}
Expand Down

0 comments on commit 67e024d

Please sign in to comment.