OpenSearch/docs/java-rest/high-level/ml/get-categories.asciidoc

53 lines
1.8 KiB
Plaintext

--
:api: get-categories
:request: GetCategoriesRequest
:response: GetCategoriesResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Get categories API
Retrieves one or more category results.
It accepts a +{request}+ object and responds with a +{response}+ object.
[id="{upid}-{api}-request"]
==== Get categories request
A +{request}+ object gets created with an existing non-null `jobId`.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Constructing a new request referencing an existing `jobId`.
==== Optional arguments
The following arguments are optional:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-category-id]
--------------------------------------------------
<1> The ID of the category to get. Otherwise, it will return all categories.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-page]
--------------------------------------------------
<1> The page parameters `from` and `size`. `from` specifies the number of
categories to skip. `size` specifies the maximum number of categories to get.
Defaults to `0` and `100` respectively.
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Get categories response
The returned +{response}+ contains the requested categories:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The count of categories that were matched.
<2> The categories retrieved.