Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 1.57 KB

ppl-head-command.md

File metadata and controls

60 lines (44 loc) · 1.57 KB

PPL head command

Description The head command returns the first N number of specified results after an optional offset in search order.

Syntax

head [<size>] [from <offset>]

  • : optional integer. number of results to return. Default: 10
  • : integer after optional from. number of results to skip. Default: 0

Example 1: Get first 10 results

The example show maximum 10 results from accounts index.

PPL query:

os> source=accounts | fields firstname, age | head;
fetched rows / total rows = 4/4
+-------------+-------+
| firstname   | age   |
|-------------+-------|
| Amber       | 32    |
| Hattie      | 36    |
| Nanette     | 28    |
| Dale        | 33    |
+-------------+-------+

Example 2: Get first N results

The example show first N results from accounts index.

PPL query:

os> source=accounts | fields firstname, age | head 3;
fetched rows / total rows = 3/3
+-------------+-------+
| firstname   | age   |
|-------------+-------|
| Amber       | 32    |
| Hattie      | 36    |
| Nanette     | 28    |
+-------------+-------+

Example 3: Get first N results after offset M

The example show first N results after offset M from accounts index.

PPL query:

os> source=accounts | fields firstname, age | head 3 from 1;
fetched rows / total rows = 3/3
+-------------+-------+
| firstname   | age   |
|-------------+-------|
| Hattie      | 36    |
| Nanette     | 28    |
| Dale        | 33    |
+-------------+-------+