File tree 2 files changed +11
-10
lines changed
spark-sql-application/src/main/scala/org/apache/spark/sql
2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -394,7 +394,13 @@ trait FlintJobExecutor {
394
394
mapping : String ): Either [String , Unit ] = {
395
395
try {
396
396
logInfo(s " create $resultIndex" )
397
- osClient.createIndex(resultIndex, mapping)
397
+ val fastRefreshSettings =
398
+ """ {
399
+ | "auto_refresh": "true",
400
+ | "refresh_interval": "1 Second",
401
+ | }
402
+ |""" .stripMargin
403
+ osClient.createIndex(resultIndex, mapping, fastRefreshSettings)
398
404
logInfo(s " create $resultIndex successfully " )
399
405
Right (())
400
406
} catch {
Original file line number Diff line number Diff line change @@ -61,25 +61,20 @@ class OSClient(val flintOptions: FlintOptions) extends Logging {
61
61
* the name of the index
62
62
* @param mapping
63
63
* the mapping of the index
64
+ * @param settings
65
+ * * the index settings as a JSON string
64
66
* @return
65
67
* use Either for representing success or failure. A Right value indicates success, while a
66
68
* Left value indicates an error.
67
69
*/
68
- def createIndex (osIndexName : String , mapping : String ): Unit = {
70
+ def createIndex (osIndexName : String , mapping : String , settings : String ): Unit = {
69
71
logInfo(s " create $osIndexName" )
70
72
71
73
using(flintClient.createClient()) { client =>
72
74
val request = new CreateIndexRequest (osIndexName)
73
- val fastRefreshSettings =
74
- """ {
75
- | "auto_refresh": "true",
76
- | "refresh_interval": "1 Second",
77
- | }
78
- |""" .stripMargin
79
-
80
75
request
81
76
.mapping(mapping, XContentType .JSON )
82
- .settings(fastRefreshSettings , XContentType .JSON )
77
+ .settings(settings , XContentType .JSON )
83
78
84
79
try {
85
80
client.createIndex(request, RequestOptions .DEFAULT )
You can’t perform that action at this time.
0 commit comments