<commit_before>--
:api: find-structure
:request: FindStructureRequest
:response: FindStructureResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Find structure API

experimental::[]

Determines the structure of text and other information that will be
useful to import its contents to an {es} index. It accepts a +{request}+ object
and responds with a +{response}+ object.

[id="{upid}-{api}-request"]
==== Find structure request

A sample of the text to analyze must be added to the +{request}+
object using the `FindStructureRequest#setSample` method.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Create a new `FindStructureRequest` object
<2> Add the contents of `anInterestingFile` to the request

==== Optional arguments

The following arguments are optional.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-options]
--------------------------------------------------
<1> Set the maximum number of lines to sample (the entire sample will be
    used if it contains fewer lines)
<2> Request that an explanation of the analysis be returned in the response

include::../execution.asciidoc[]

[id="{upid}-{api}-response"]
==== Find structure response

A +{response}+ contains information about the text structure,
as well as mappings and an ingest pipeline that could be used
to index the contents into {es}.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]<commit_msg>[DOCS] Remove experimental tag from find structure API (#68153)<commit_after>--
:api: find-structure
:request: FindStructureRequest
:response: FindStructureResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Find structure API

Determines the structure of text and other information that will be
useful to import its contents to an {es} index. It accepts a +{request}+ object
and responds with a +{response}+ object.

[id="{upid}-{api}-request"]
==== Find structure request

A sample of the text to analyze must be added to the +{request}+
object using the `FindStructureRequest#setSample` method.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Create a new `FindStructureRequest` object
<2> Add the contents of `anInterestingFile` to the request

==== Optional arguments

The following arguments are optional:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request-options]
--------------------------------------------------
<1> Set the maximum number of lines to sample (the entire sample will be
    used if it contains fewer lines)
<2> Request that an explanation of the analysis be returned in the response

include::../execution.asciidoc[]

[id="{upid}-{api}-response"]
==== Find structure response

A +{response}+ contains information about the text structure,
as well as mappings and an ingest pipeline that could be used
to index the contents into {es}.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
{'fraction_non_alphanumeric': 0.25513112884834666, 'fraction_numerical': 0.0037058152793614596, 'mean_word_length': 2.748931623931624, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4626282', 'n_tokens_mistral': 876, 'n_tokens_neox': 854, 'n_words': 322}