File tree 1 file changed +9
-0
lines changed
modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 23
23
import org .elasticsearch .util .xcontent .XContentFactory ;
24
24
import org .elasticsearch .util .xcontent .XContentType ;
25
25
import org .elasticsearch .util .xcontent .builder .BinaryXContentBuilder ;
26
+ import org .elasticsearch .util .xcontent .builder .XContentBuilder ;
26
27
27
28
import java .io .IOException ;
28
29
@@ -47,6 +48,14 @@ public static BinaryXContentBuilder restContentBuilder(RestRequest request) thro
47
48
if (request .paramAsBoolean ("pretty" , false )) {
48
49
builder .prettyPrint ();
49
50
}
51
+ String casing = request .param ("case" );
52
+ if (casing != null && "camelCase" .equals (casing )) {
53
+ builder .fieldCaseConversion (XContentBuilder .FieldCaseConversion .CAMELCASE );
54
+ } else {
55
+ // we expect all REST interfaces to write results in underscore casing, so
56
+ // no need for double casing
57
+ builder .fieldCaseConversion (XContentBuilder .FieldCaseConversion .NONE );
58
+ }
50
59
return builder ;
51
60
}
52
61
}
You can’t perform that action at this time.
0 commit comments