Elasticlient
scroll.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <string>
9 #include <memory>
10 #include <vector>
11 #include <cstdint>
12 
13 
14 // Forward Json::Value existence.
15 namespace Json {
16  class Value;
17 }
18 
19 
21 namespace elasticlient {
22 
23 
24 // Forward Client class existence.
25 class Client;
26 
27 
29 class Scroll {
30  protected:
31  class Implementation;
33  std::unique_ptr<Implementation> impl;
34 
35  public:
43  explicit Scroll(const std::shared_ptr<Client> &client,
44  std::size_t scrollSize = 100,
45  const std::string &scrollTimeout = "1m");
46 
56  explicit Scroll(const std::vector<std::string> &hostUrlList,
57  std::size_t scrollSize = 100,
58  const std::string &scrollTimeout = "1m",
59  std::int32_t connectionTimeout = 6000);
60 
61  Scroll(Scroll &&);
62 
63  virtual ~Scroll();
64 
66  void clear();
67 
74  void init(const std::string &indexName,
75  const std::string &docType,
76  const std::string &searchBody);
77 
83  bool next(Json::Value &parsedResult);
84 
86  const std::shared_ptr<Client> &getClient() const;
87 
88  protected:
90  virtual bool createScroll(Json::Value &parsedResult);
91 };
92 
93 
95 class ScrollByScan : public Scroll {
96  public:
98 
100  explicit ScrollByScan(const std::shared_ptr<Client> &client,
101  std::size_t scrollSize = 100,
102  const std::string &scrollTimeout = "1m",
103  int primaryShardsCount = 0);
104 
106  explicit ScrollByScan(const std::vector<std::string> &hostUrlList,
107  std::size_t scrollSize = 100,
108  const std::string &scrollTimeout = "1m",
109  int primaryShardsCount = 0,
110  std::int32_t connectionTimeout = 6000);
111 
112  protected:
119  virtual bool createScroll(Json::Value &parsedResult) override;
120 };
121 
122 
123 } // namespace elasticlient
elasticlient::Scroll::next
bool next(Json::Value &parsedResult)
elasticlient::ScrollByScan::createScroll
virtual bool createScroll(Json::Value &parsedResult) override
elasticlient::Scroll
Class for use of Elasticsearch Scroll API.
Definition: scroll.h:29
elasticlient::Scroll::getClient
const std::shared_ptr< Client > & getClient() const
Return Client class with current config.
elasticlient::Scroll::impl
std::unique_ptr< Implementation > impl
Hidden implementation and data holder.
Definition: scroll.h:31
elasticlient::Scroll::clear
void clear()
Clear scroll for next usage. Should be called immediately after last next() was called.
elasticlient
The elasticlient namespace.
Definition: bulk.h:15
elasticlient::Scroll::createScroll
virtual bool createScroll(Json::Value &parsedResult)
Creates new scroll - obtain scrollId and parsedResult.
elasticlient::Scroll::Scroll
Scroll(const std::shared_ptr< Client > &client, std::size_t scrollSize=100, const std::string &scrollTimeout="1m")
elasticlient::ScrollByScan
Class for use of Elasticsearch Scroll API with deprecated scan option.
Definition: scroll.h:95
elasticlient::Scroll::init
void init(const std::string &indexName, const std::string &docType, const std::string &searchBody)