Validation Failed: 1: type is missing;
tr0mb1r opened this issue · 1 comments
Description:
An error appears when you try to post data in elasticsearch v6.8.2
Suggested Labels:
elasticsearch,siddhi,tooling
Suggested Assignees:
@mohanvive
Affected Product Version:
siddhi-tooling 0.1.0
OS, DB, other environment details and versions:
elasticsearch 6.8.2, siddhi-tooling 0.1.0
Steps to reproduce:
- install elasticsearch 6.*
- install elasticsearch module 3.0.0 (module)
- create simple app to store something in new index
@App:name("testApp")
@App:description("Description of the plan")
@source(type = 'http', receiver.url = "http://0.0.0.0:8006/cargo",@map(type = 'json'))
define stream CargoStream (weight int);
@store(type='elasticsearch', hostname='localhost',port='9200',index.name='siddhi',index.type='_doc')))
define table aps (weight int);
@info(name='JustAQuery')
from CargoStream#window.length(3)
select weight
insert into aps;
The bulk request contains next data:
{"index":{"_index":"siddhi"}}
{"weight":123}
but the initial request in bulk must be:
{"index":{"_index":"siddhi","_type":"_doc"}}
4. to reproduce correct request via kibana:
POST /siddhi/_bulk
{"index":{"_index":"siddhi","_type":"_doc"}}
{"weight":123}
Response with correct request:
{
"took" : 4,
"errors" : false,
"items" : [
{
"index" : {
"_index" : "siddhi",
"_type" : "_doc",
"_id" : "wDuA3WwBwwW5YdVipfGj",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 0,
"_primary_term" : 1,
"status" : 201
}
}
]
}
Related Issues:
#19
ERROR
[2019-08-29 15:08:04,054] ERROR {io.siddhi.extension.store.elasticsearch.ElasticsearchEventTable} - Failed to execute bulk ElasticsearchStatusException[Elasticsearch exception [type=action_request_validation_exception, reason=Validation Failed: 1: type is missing;]]
at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1706)
at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1683)
at org.elasticsearch.client.RestHighLevelClient$1.onFailure(RestHighLevelClient.java:1600)
at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onDefinitiveFailure(RestClient.java:580)
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:317)
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:301)
at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119)
at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:177)
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436)
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:326)
at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
at java.lang.Thread.run(Thread.java:748)
Suppressed: org.elasticsearch.client.ResponseException: method [POST], host [http://localhost:9200], URI [/_bulk?timeout=1m], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: type is missing;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: type is missing;"},"status":400}
at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:260)
at org.elasticsearch.client.RestClient.access$900(RestClient.java:95)
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:305)
... 16 more
Above issue is encountered because latest siddhi-store-elaticsearch extensions can only works with elasticsearch 7.x.x and above. And there were no any previous releases that are based on Siddhi 5.x.x releases.
Hence, we have created a separate branch to maintain siddhi-store-elasticsearch extension which supports elasticsearch 6.x.x and based on Siddhi 5.x.x. This will be released as version 1.5.x ...