[[document-data]]
== Viewing Document Data

When you submit a search query, the 500 most recent documents that match the query
are listed in the Documents table. You can configure the number of documents shown
in the table by setting the `discover:sampleSize` property in <<advanced-options,
Advanced Settings>>. By default, the table shows the localized version of the time
field configured for the selected index pattern and the document `_source`. You can
<<adding-columns, add fields to the Documents table>> from the Fields list.
You can <<sorting, sort the listed documents>> by any indexed field that's included
in the table.

To view a document's field data, click the *Expand* button 
image:images/ExpandButton.jpg[Expand Button] to the left of the document's table
entry. 

image::images/Expanded-Document.png[]

To view the original JSON document (pretty-printed), click the *JSON* tab.

To view the document data as a separate page, click the *View single document* 
link. You can bookmark and share this link to provide direct access to a 
particular document.

To display or hide a field's column in the Documents table, click the
image:images/add-column-button.png[Add Column] *Toggle column in table* button.

To collapse the document details, click the *Collapse* button 
image:images/CollapseButton.jpg[Collapse Button].

[float]
[[sorting]]
=== Sorting the Document List
You can sort the documents in the Documents table by the values in any indexed
field. If a time field is configured for the current index pattern, the 
documents are sorted in reverse chronological order by default.

To change the sort order, hover over the name of the field you want to sort by
and click the sort button. Click again to reverse the sort order.

[float]
[[adding-columns]]
=== Adding Field Columns to the Documents Table
By default, the Documents table shows the localized version of the time field
that's configured for the selected index pattern and the document `_source`. 
You can add fields to the table from the Fields list or from a document's
field data.

To add a field column from the Fields list, hover over the field and click its
*add* button.

To add a field column from a document's field data, expand the document
and click the field's
image:images/add-column-button.png[Add Column] *Toggle column in table* button.

Added field columns replace the `_source` column in the Documents table. The added
fields are also added to the *Selected Fields* list.

To rearrange the field columns, hover over the header of the column you want to move
and click the *Move left* or *Move right* button.

image:images/Discover-MoveColumn.jpg[Move Column]

[float]
[[removing-columns]]
=== Removing Field Columns from the Documents Table
To remove a field column from the Documents table, hover over the header of the 
column you want to remove and click the *Remove* button 
image:images/RemoveFieldButton.jpg[Remove Field Button].