What version are you on?
5.0 GA
What do the docs look like, what about the mapping?
Anonymized to protect the innocent...
Mappings:
{"index_one":{"mappings":{"document_one":{"_source":{"enabled":false},"properties":{"field1":{"type":"text"},"created_at":{"type":"long"},"field2":{"type":"text"},"field3":{"type":"text"},"field4":{"type":"text"},"field5":{"type":"text"},"field6":{"type":"long"},"field7":{"type":"text"},"field8":{"type":"text"},"field9":{"type":"text"},"field10":{"type":"text"},"field11":{"type":"text"},"field12":{"type":"text"},"field13":{"type":"text"},"field14":{"type":"text"},"field15":{"type":"text"},"field16":{"type":"text"}}}}}}
{"index_two":{"mappings":{"document_two":{"_source":{"enabled":false},"properties":{"field1":{"type":"text"},"field2":{"type":"text"},"field3":{"type":"text"},"field4":{"type":"text"},"field5":{"type":"long"},"field6":{"properties":{"fieldX1":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"fieldX2":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"fieldX3":{"properties":{"fieldX4":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"fieldX5":{"properties":{"fieldX6":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}}}}}},"field7":{"type":"text"},"field8":{"type":"text"},"field9":{"type":"long"},"field10":{"type":"text"},"field10":{"type":"text"},"field11":{"type":"text"},"field12":{"type":"text"},"field13":{"type":"text"},"field14":{"type":"text"},"field15":{"type":"text"},"type":{"type":"text"}}}}}}
Example documents:
Document_two:
{
"field1": 5,
"field2": "a sentence of text",
"field3": "aWord",
"field4": "aWord",
"field5": "aWord",
"field6": "aWord",
"field7": "aWord",
"field8": "aWord",
"field9": "aWord",
"field10": "aWord",
"field11" : {
"fieldX1: "aWord",
"fieldX2: {
"fieldX3" : "aWord"
}
}
"field12": 1476313771,
"field13": 1476313786,
"field14" : ["aWord", "aWord"],
"field15" : "aWord",
"field16" : "aWord",
"field17" : "aWord",
}
Document_one:
{
"field1" : 1455186369,
"field2" : [ "aWord", "aWord" ],
"field3" : "aWord",
"field4" : [ "aWord" ],
"field5" : 10073,
"field6" : "aWord",
"field7" : "aWord",
"field8" : 1455186368,
"field9" : [ "aWord", "aWord" ],
"field10" : [ "aWord" ],
"field11" : 10073,
"field12" : "aWord",
"field13" : "aWord"
}
The mappings might not exactly match the documents as I manually renamed fields but hopefully you get the idea.
The timings I gave you above were for 1.3 million documents. If I run all the logic apart from the following line it takes 1 min 50 seconds (So about 2 mins+ more when the bulk api is called):
// For 1000 documents (_bulk)
// Response response = restClient.performRequest(
// PUT,
// path,
// new Hashtable<>(),
// requestBody);
I should add than my indexing program is single threaded.