| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 | --:api: find-file-structure:request: FindFileStructureRequest:response: FindFileStructureResponse--[role="xpack"][id="{upid}-{api}"]=== Find File Structure APIThe Find File Structure API can be used to find the structure of a text fileand other information that will be useful to import its contents to an {es}index.  It accepts a +{request}+ object and respondswith a +{response}+ object.[id="{upid}-{api}-request"]==== Find File Structure RequestA sample from the beginning of the file (or the entire file contents ifit's small) must be added to the +{request}+ object using the`FindFileStructureRequest#setSample` method.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request]--------------------------------------------------<1> Create a new `FindFileStructureRequest` object<2> Add the contents of `anInterestingFile` to the request==== Optional ArgumentsThe 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 responseinclude::../execution.asciidoc[][id="{upid}-{api}-response"]==== Find File Structure ResponseA +{response}+ contains information about the file structure,as well as mappings and an ingest pipeline that could be usedto index the contents into {es}.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-response]--------------------------------------------------<1> The `FileStructure` object contains the structure information
 |