-
Notifications
You must be signed in to change notification settings - Fork 247
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
How to use the enum 'co.elastic.clients.elasticsearch._types.Time.Kind.offset' #914
Comments
Hello! The GET /_cluster/health?timeout=0
GET /_cluster/health?timeout=2s In java you can write those as: esClient.cluster().health(h -> h.timeout(Time.of(t -> t.offset(0))))
esClient.cluster().health(h -> h.timeout(Time.of(t -> t.time("2s")))) Hope this clarifies things for you, let me know :) |
@l-trotta Thanks for your answer. But I still have some confusions.I use scroll api, when I use kind of 'Time', '2d' means snapshot of scroll matain 2 days. When I use kind of offset, what's mean that 2 offset? |
Ah I get the confusion: |
@l-trotta Thanks for your patience. I am chinese, so my english is poor 😂. SearchRequest searchRequest = new SearchRequest.Builder()
.index(indexName)
.query(new Query(new MatchQuery.Builder().field("labels").query(label).build()))
.scroll(new Time.Builder().offset(0).build())
.size(2)
.build(); What's mean that 'new Time.Builder().offset(0).build()' in the above code ? |
Don't worry about your english :) I'll try to be as clear as possible: Let's check the documentation for
So you can set a value that will determine how long the search context will be kept in memory, and it also tells you that by default the maximum value is 1d. So for example is you want to keep it for 10 hours then you'll write: .scroll(Time.of(t -> t.time("10h"))) You can check the Time Units documentation for references on the various accepted units. Now, if you were to set .scroll(Time.of(t -> t.offset(0))) This will select the default value of scroll, which as the documentation said is 1 day! Hope this clarifies how Time works! |
@l-trotta Thank you very much. I get it. The 'Time' class is generic, so it needed support multiple case. Someone maybe want to use number, others want to use string, so, the 'Time' class have two kind(time and offset). The kind of 'offset' can set numbers which we want to use, according to our needs. In my case(scroll api), 'Time.time' is satisfies my needs, I can ignore 'Time.offset'. |
I know the useage for Kind.Time, but I can't find any useful message about Kind.Offset. None of comment about 'Offset' in code, none of specification, so I don't know how to use the enum 'Kind.Offset'. Please tell me the useage, thanks in advance.
The text was updated successfully, but these errors were encountered: