How do you send bulk inserts with no ids to elasticsearch
up vote
0
down vote
favorite
I'm trying to use the bulk inset api for elastic search. I would like to insert documents with auto generated IDs but I'm just getting errors no matter what i try.
Here are a few example efforts:
http://localhost:9200/_bulk
{"create": {"_index": "test", "_type": "_doc"} }
{"user": "kimchy", "post_date": "2002-11-15T14:12:12", "message": "trying out Elasticsearch"}
Both put and post give the error:
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: an id must be provided if version type or value are set;"
}
],
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: an id must be provided if version type or value are set;"
},
"status": 400
}
If i remove _type _doc i get the following error:
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: type is missing;2: an id is required for a CREATE operation;3: an id must be provided if version type or value are set;"
}
],
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: type is missing;2: an id is required for a CREATE operation;3: an id must be provided if version type or value are set;"
},
"status": 400
}
I'm using elastic search 6.4.2 via docker
~ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
elasticsearch 6.4.2 e47ebd7ec3ee 7 weeks ago 828MB
Currently sending requests via postman
elasticsearch
add a comment |
up vote
0
down vote
favorite
I'm trying to use the bulk inset api for elastic search. I would like to insert documents with auto generated IDs but I'm just getting errors no matter what i try.
Here are a few example efforts:
http://localhost:9200/_bulk
{"create": {"_index": "test", "_type": "_doc"} }
{"user": "kimchy", "post_date": "2002-11-15T14:12:12", "message": "trying out Elasticsearch"}
Both put and post give the error:
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: an id must be provided if version type or value are set;"
}
],
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: an id must be provided if version type or value are set;"
},
"status": 400
}
If i remove _type _doc i get the following error:
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: type is missing;2: an id is required for a CREATE operation;3: an id must be provided if version type or value are set;"
}
],
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: type is missing;2: an id is required for a CREATE operation;3: an id must be provided if version type or value are set;"
},
"status": 400
}
I'm using elastic search 6.4.2 via docker
~ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
elasticsearch 6.4.2 e47ebd7ec3ee 7 weeks ago 828MB
Currently sending requests via postman
elasticsearch
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to use the bulk inset api for elastic search. I would like to insert documents with auto generated IDs but I'm just getting errors no matter what i try.
Here are a few example efforts:
http://localhost:9200/_bulk
{"create": {"_index": "test", "_type": "_doc"} }
{"user": "kimchy", "post_date": "2002-11-15T14:12:12", "message": "trying out Elasticsearch"}
Both put and post give the error:
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: an id must be provided if version type or value are set;"
}
],
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: an id must be provided if version type or value are set;"
},
"status": 400
}
If i remove _type _doc i get the following error:
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: type is missing;2: an id is required for a CREATE operation;3: an id must be provided if version type or value are set;"
}
],
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: type is missing;2: an id is required for a CREATE operation;3: an id must be provided if version type or value are set;"
},
"status": 400
}
I'm using elastic search 6.4.2 via docker
~ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
elasticsearch 6.4.2 e47ebd7ec3ee 7 weeks ago 828MB
Currently sending requests via postman
elasticsearch
I'm trying to use the bulk inset api for elastic search. I would like to insert documents with auto generated IDs but I'm just getting errors no matter what i try.
Here are a few example efforts:
http://localhost:9200/_bulk
{"create": {"_index": "test", "_type": "_doc"} }
{"user": "kimchy", "post_date": "2002-11-15T14:12:12", "message": "trying out Elasticsearch"}
Both put and post give the error:
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: an id must be provided if version type or value are set;"
}
],
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: an id must be provided if version type or value are set;"
},
"status": 400
}
If i remove _type _doc i get the following error:
{
"error": {
"root_cause": [
{
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: type is missing;2: an id is required for a CREATE operation;3: an id must be provided if version type or value are set;"
}
],
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: type is missing;2: an id is required for a CREATE operation;3: an id must be provided if version type or value are set;"
},
"status": 400
}
I'm using elastic search 6.4.2 via docker
~ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
elasticsearch 6.4.2 e47ebd7ec3ee 7 weeks ago 828MB
Currently sending requests via postman
elasticsearch
elasticsearch
asked yesterday
Damo
627523
627523
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
If you want automatic id creation simply use index
instead of create
:
change this
|
v
{"index": {"_index": "test", "_type": "_doc"} }
{"user": "kimchy", "post_date": "2002-11-15T14:12:12", "message": "trying out Elasticsearch"}
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
If you want automatic id creation simply use index
instead of create
:
change this
|
v
{"index": {"_index": "test", "_type": "_doc"} }
{"user": "kimchy", "post_date": "2002-11-15T14:12:12", "message": "trying out Elasticsearch"}
add a comment |
up vote
1
down vote
accepted
If you want automatic id creation simply use index
instead of create
:
change this
|
v
{"index": {"_index": "test", "_type": "_doc"} }
{"user": "kimchy", "post_date": "2002-11-15T14:12:12", "message": "trying out Elasticsearch"}
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
If you want automatic id creation simply use index
instead of create
:
change this
|
v
{"index": {"_index": "test", "_type": "_doc"} }
{"user": "kimchy", "post_date": "2002-11-15T14:12:12", "message": "trying out Elasticsearch"}
If you want automatic id creation simply use index
instead of create
:
change this
|
v
{"index": {"_index": "test", "_type": "_doc"} }
{"user": "kimchy", "post_date": "2002-11-15T14:12:12", "message": "trying out Elasticsearch"}
answered yesterday
Val
97.9k6124163
97.9k6124163
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371373%2fhow-do-you-send-bulk-inserts-with-no-ids-to-elasticsearch%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown