Import value list items
Import value list items from a TXT or CSV file. The maximum file size is 9 million bytes.
You can import items to a new or existing list.
Query parameters
-
list_id string(nonempty)
List's id.
Required when importing to an existing list.
Minimum length is
1
. -
type string
Type of the importing list.
Required when importing a new list whose list
id
is not specified.Values are
binary
,boolean
,byte
,date
,date_nanos
,date_range
,double
,double_range
,float
,float_range
,geo_point
,geo_shape
,half_float
,integer
,integer_range
,ip
,ip_range
,keyword
,long
,long_range
,shape
,short
, ortext
. -
serializer string
Determines how uploaded list item values are parsed. By default, list items are parsed using these named regex groups:
(?<value>.+)
- Single value item types, such as ip, long, date, keyword, and text.(?<gte>.+)-(?<lte>.+)|(?<value>.+)
- Range value item types, such asdate_range
,ip_range
,double_range
,float_range
,integer_range
, andlong_range
.
-
deserializer string
Determines how retrieved list item values are presented. By default list items are presented using these Handelbar expressions:
{{{value}}}
- Single value item types, such asip
,long
,date
,keyword
, andtext
.{{{gte}}}-{{{lte}}}
- Range value item types, such asip_range
,double_range
,float_range
,integer_range
, andlong_range
.{{{gte}}},{{{lte}}}
- Date range values.
-
refresh string
Determines when changes made by the request are made visible to search.
Values are
true
,false
, orwait_for
.
Responses
-
200 application/json
Successful response
-
400 application/json
Invalid input data response
-
401 application/json
Unsuccessful authentication response
-
403 application/json
Not enough privileges response
-
409 application/json
List with specified list_id does not exist response
-
500 application/json
Internal server error response
curl \
--request POST https://localhost:5601/api/lists/items/_import \
--header "Content-Type: multipart/form-data" \
--form "file=127.0.0.1
127.0.0.2
127.0.0.3
127.0.0.4
127.0.0.5
127.0.0.6
127.0.0.7
127.0.0.8
127.0.0.9
"
{
"id": "ip_list",
"name": "Simple list with an ip",
"type": "ip",
"version": 1,
"_version": "WzAsMV0=",
"immutable": false,
"@timestamp": "2025-01-08T04:47:34.273Z",
"created_at": "2025-01-08T04:47:34.273Z",
"created_by": "elastic",
"updated_at": "2025-01-08T04:47:34.273Z",
"updated_by": "elastic",
"description": "This list describes bad internet ip",
"tie_breaker_id": "f5508188-b1e9-4e6e-9662-d039a7d89899"
}
{
"message": "Either type or list_id need to be defined in the query",
"status_code": 400
}
{
"error": "Unauthorized",
"message": "[security_exception\\n\\tRoot causes:\\n\\t\\tsecurity_exception: unable to authenticate user [elastic] for REST request [/_security/_authenticate]]: unable to authenticate user [elastic] for REST request [/_security/_authenticate]",
"statusCode": 401
}
{
"error": "Forbidden",
"message": "API [POST /api/lists/items/_import?list_id=ip_list] is unauthorized for user, this action is granted by the Kibana privileges [lists-all]",
"statusCode": 403
}
{
"message": "string",
"status_code": 42
}
{
"message": "Internal Server Error",
"status_code": 500
}