c# - Can't index with LowLevel.Bulk API -
nest/elasticsearch.net version: 5.5.0
elasticsearch version: 5.5.1
i have json file size 23mb, , give exception when try index on lowlevel.bulk api
system.exception: unsuccessful low level call on post: /people/person/_bulk # audit trail of api call: - [1] badrequest: node: http://elasticsearch:9200/ took: 00:00:08.3353648 # originalexception: system.net.http.httprequestexception: error occurred while sending request. ---> system.net.http.curlexception: couldn't connect server @ system.net.http.curlhandler.throwifcurleerror(curlcode error) @ system.net.http.curlhandler.multiagent.finishrequest(strongtoweakreference`1 easywrapper, curlcode messageresult) --- end of inner exception stack trace --- @ system.runtime.exceptionservices.exceptiondispatchinfo.throw() @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ system.runtime.compilerservices.configuredtaskawaitable`1.configuredtaskawaiter.getresult() @ system.net.http.httpclient.<finishsendasyncbuffered>d__58.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.exceptionservices.exceptiondispatchinfo.throw() @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ elasticsearch.net.httpconnection.request[treturn](requestdata requestdata) in c:\users\russ\source\elasticsearch-net-5.x\src\elasticsearch.net\connection\httpconnection-corefx.cs:line 78 # request: { "index": {} } {"addresses": [{"country": "iraq", "street": "p.o. box 2101", "region": "baghdad", "city": "masbeh square", "country_code": "iq"}], "source": "un-sc-sanctions", "name": "state organization construction industries", "first_name": "state organization construction industries", "id": "un-sc-sanctions.6908303", "timestamp": "2017-08-20t20:04:06.906071", "listed_at": "2004-04-26", "type": "entity", "program": "iraq (iqe.168)"} controller.cs
var indexresponse = _elasticclient .lowlevel .bulk<voidresponse>( _index, _type, new postdata<object>( new elasticpostcommands( new lines( new jsonfile(@"./data/master.json") ) ) ) ); elasticpostcommands.cs
public class elasticpostcommands : ienumerable<string> { private readonly ilines _lines; private readonly string _commandformat = "{{ \"index\": {{}} }}\n{0}"; public elasticpostcommands(ilines lines) { _lines = lines; } public ienumerator<string> getenumerator() { return _lines .select(l => string.format(_commandformat, l)) .getenumerator(); } ienumerator ienumerable.getenumerator() { return getenumerator(); } } master.json
{"source": "un-sc-sanctions", "identifiers": [{"number": "381310014", "type": "passport"}], "name": "ri won ho", "summary": "ri won ho dprk ministry of state security official stationed in syria supporting komid.", "second_name": "won ho", "function": "dprk ministry of state security official", "nationalities": [{"country": "democratic people's republic of korea", "country_code": "kp"}], "first_name": "ri", "id": "un-sc-sanctions.6908555", "timestamp": "2017-08-20t20:04:04.549289", "birth_dates": [{"date": "1964-07-17", "quality": "strong"}], "listed_at": "2016-11-30", "type": "individual", "program": "dprk (kpi.033)"} {"source": "un-sc-sanctions", "name": "chang chang ha", "second_name": "chang ha", "function": "president of second academy of natural sciences (sans)", "nationalities": [{"country": "democratic people's republic of korea", "country_code": "kp"}], "first_name": "chang", "id": "un-sc-sanctions.6908570", "timestamp": "2017-08-20t20:04:04.550409", "birth_dates": [{"date": "1964-01-10", "quality": "strong"}], "listed_at": "2016-11-30", "aliases": [{"name": "jang chang ha", "quality": "strong"}], "type": "individual", "program": "dprk (kpi.037)"} ... elasticsearch running in docker container, , asp.net core 2.0 project in docker container. when try run asp.net core iis express, works fine.
how run containers:
docker run -p 9200:9200 --name elasticsearch elasticsearch:latest docker run -p 8081:80 --name my_project_name --link elasticsearch my_project_image_name ping container elasticsearch:
root@02d9325568c4:/etc# ping elasticsearch ping elasticsearch (172.17.0.3): 56 data bytes 64 bytes 172.17.0.3: icmp_seq=0 ttl=64 time=0.113 ms 64 bytes 172.17.0.3: icmp_seq=1 ttl=64 time=0.084 ms 64 bytes 172.17.0.3: icmp_seq=2 ttl=64 time=0.082 ms 64 bytes 172.17.0.3: icmp_seq=3 ttl=64 time=0.084 ms 64 bytes 172.17.0.3: icmp_seq=4 ttl=64 time=0.118 ms after receiving exception, elasticsearch container stops , can't run until project_image_container running.
Comments
Post a Comment