Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8639bb9

Browse files
committed
csv - change headers to list instead of hashset to maintain order
1 parent 36150f5 commit 8639bb9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/org/elasticsearch/plugin/nlpcn/executors/CSVResultsExtractor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,14 @@ private List<String> createHeadersAndFillDocsMap(boolean flat, SearchHit[] hits,
271271
}
272272
docsAsMap.add(doc);
273273
}
274+
ArrayList<String> headersList = new ArrayList<>(csvHeaders);
274275
if (this.includeScore){
275-
csvHeaders.add("_score");
276+
headersList.add("_score");
276277
}
277278
if (this.includeType){
278-
csvHeaders.add("_type");
279+
headersList.add("_type");
279280
}
280-
return new ArrayList<>(csvHeaders);
281+
return headersList;
281282
}
282283

283284
private String findFieldValue(String header, Map<String, Object> doc, boolean flat, String separator) {

0 commit comments

Comments
 (0)