find-file-structure.asciidoc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --
  2. :api: find-file-structure
  3. :request: FindFileStructureRequest
  4. :response: FindFileStructureResponse
  5. --
  6. [role="xpack"]
  7. [id="{upid}-{api}"]
  8. === Find File Structure API
  9. The Find File Structure API can be used to find the structure of a text file
  10. and other information that will be useful to import its contents to an {es}
  11. index. It accepts a +{request}+ object and responds
  12. with a +{response}+ object.
  13. [id="{upid}-{api}-request"]
  14. ==== Find File Structure Request
  15. A sample from the beginning of the file (or the entire file contents if
  16. it's small) must be added to the +{request}+ object using the
  17. `FindFileStructureRequest#setSample` method.
  18. ["source","java",subs="attributes,callouts,macros"]
  19. --------------------------------------------------
  20. include-tagged::{doc-tests-file}[{api}-request]
  21. --------------------------------------------------
  22. <1> Create a new `FindFileStructureRequest` object
  23. <2> Add the contents of `anInterestingFile` to the request
  24. ==== Optional Arguments
  25. The following arguments are optional.
  26. ["source","java",subs="attributes,callouts,macros"]
  27. --------------------------------------------------
  28. include-tagged::{doc-tests-file}[{api}-request-options]
  29. --------------------------------------------------
  30. <1> Set the maximum number of lines to sample (the entire sample will be
  31. used if it contains fewer lines)
  32. <2> Request that an explanation of the analysis be returned in the response
  33. include::../execution.asciidoc[]
  34. [id="{upid}-{api}-response"]
  35. ==== Find File Structure Response
  36. A +{response}+ contains information about the file structure,
  37. as well as mappings and an ingest pipeline that could be used
  38. to index the contents into {es}.
  39. ["source","java",subs="attributes,callouts,macros"]
  40. --------------------------------------------------
  41. include-tagged::{doc-tests-file}[{api}-response]
  42. --------------------------------------------------
  43. <1> The `FileStructure` object contains the structure information