File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,17 @@ public function execute()
72
72
$ body = '{} ' ;
73
73
} elseif (is_array ($ this ->actions )) {
74
74
$ body = '' ;
75
+ $ prettyPrintSupported = property_exists ('yii \\helpers \\Json ' , 'prettyPrint ' );
76
+ if ($ prettyPrintSupported ) {
77
+ $ originalPrettyPrint = Json::$ prettyPrint ;
78
+ Json::$ prettyPrint = false ; // ElasticSearch bulk API uses new lines as delimiters.
79
+ }
75
80
foreach ($ this ->actions as $ action ) {
76
81
$ body .= Json::encode ($ action ) . "\n" ;
77
82
}
83
+ if ($ prettyPrintSupported ) {
84
+ Json::$ prettyPrint = $ originalPrettyPrint ;
85
+ }
78
86
} else {
79
87
$ body = $ this ->actions ;
80
88
}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Yii Framework 2 Elasticsearch extension Change Log
4
4
2.1.5 under development
5
5
-----------------------
6
6
7
- - no changes in this release.
7
+ - Bug # 344 : Disabled JSON pretty print for ElasticSearch bulk API (rhertogh)
8
8
9
9
10
10
2.1.4 May 22, 2023
You can’t perform that action at this time.
0 commit comments