From da4b6bc46b9b74f3328bf57c43548bd303bb9c6f Mon Sep 17 00:00:00 2001 From: Michael Born <8106227+michaelborn@users.noreply.github.com> Date: Thu, 18 Apr 2024 10:32:34 -0400 Subject: [PATCH 1/2] Fix broken links in Pipelines docs --- docs/Pipelines.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Pipelines.md b/docs/Pipelines.md index f86288a..a926843 100644 --- a/docs/Pipelines.md +++ b/docs/Pipelines.md @@ -4,7 +4,7 @@ description: Learn how to transform incoming data in an Elasticsearch Ingest Pip # Ingest Pipelines -Elasticsearch allows you to create pipelines which pre-process inbound documents and data. Methods are available to create, read, update and delete pipelines. For more information on defining processors, conditionals and options see the (PUT Pipeline)[https://www.elastic.co/guide/en/elasticsearch/reference/master/put-pipeline-api.html] and (Processor)[https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest-processors.html] documentation. +Elasticsearch allows you to create pipelines which pre-process inbound documents and data. Methods are available to create, read, update and delete pipelines. For more information on defining processors, conditionals and options see the [PUT Pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/master/put-pipeline-api.html) and [Processor](https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest-processors.html) documentation. ## Creating a Pipeline @@ -107,4 +107,4 @@ For multiple documents, the pipeline may be set in the document, prior to the `s ```js getInstance( "Client@cbElasticsearch" ) .saveAll( documents=myDocuments, params={ "pipeline" : "foo-pipeline" } ); -``` \ No newline at end of file +``` From b4c3ebb9e47b06757b1d0bd5ce17d966853535bb Mon Sep 17 00:00:00 2001 From: michaelborn Date: Thu, 18 Apr 2024 14:33:08 +0000 Subject: [PATCH 2/2] Apply cfformat changes --- models/SearchBuilder.cfc | 20 ++++++++------ models/io/HyperClient.cfc | 15 +++++++---- models/logging/LogstashAppender.cfc | 42 ++++++++++++++--------------- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/models/SearchBuilder.cfc b/models/SearchBuilder.cfc index 8af1dbc..a496cab 100644 --- a/models/SearchBuilder.cfc +++ b/models/SearchBuilder.cfc @@ -177,8 +177,12 @@ component accessors="true" { * @fields Array or list of fields to pull term vectors on * @options Any custom parameters to send with the request. */ - struct function getTermVectors( string id = "", any fields = "", struct options = {} ){ - var args = arguments; + struct function getTermVectors( + string id = "", + any fields = "", + struct options = {} + ){ + var args = arguments; args.indexName = variables.index; return getClient().getTermVectors( argumentCollection = args ); @@ -196,13 +200,13 @@ component accessors="true" { return this; } - /** + /** * Backwards compatible getter for max result size - * + * * @deprecated */ any function getMaxRows(){ - return getSize(); + return getSize(); } /** @@ -217,13 +221,13 @@ component accessors="true" { return this; } - /** + /** * Backwards compatible getter for start row - * + * * @deprecated */ any function getStartRow(){ - return getFrom(); + return getFrom(); } /** diff --git a/models/io/HyperClient.cfc b/models/io/HyperClient.cfc index dc9e1d2..d563907 100644 --- a/models/io/HyperClient.cfc +++ b/models/io/HyperClient.cfc @@ -538,13 +538,18 @@ component accessors="true" threadSafe singleton { * @params struct Struct of query parameters to influence the request. For example: `"offsets": false }` * @options struct Body payload to send. For example: `{ "filter": { "max_num_terms": 3 } }` */ - struct function getTermVectors( required string indexName, string id = "", any fields = [], struct options = {} ){ + struct function getTermVectors( + required string indexName, + string id = "", + any fields = [], + struct options = {} + ){ arguments.options[ "fields" ] = arguments.fields; - if ( !isArray( arguments.options["fields"] ) ) { - arguments.options["fields"] = listToArray( arguments.options["fields"] ); + if ( !isArray( arguments.options[ "fields" ] ) ) { + arguments.options[ "fields" ] = listToArray( arguments.options[ "fields" ] ); } - var endpoint = [arguments.indexName, "_termvectors" ]; + var endpoint = [ arguments.indexName, "_termvectors" ]; if ( arguments.id != "" ) { endpoint.append( arguments.id ); } @@ -1031,7 +1036,7 @@ component accessors="true" threadSafe singleton { deleteRequest.setQueryParam( param.name, param.value ); } ); - var response = deleteRequest.send(); + var response = deleteRequest.send(); var deleteResult = response.json(); if ( arguments.throwOnError && structKeyExists( deleteResult, "error" ) ) { diff --git a/models/logging/LogstashAppender.cfc b/models/logging/LogstashAppender.cfc index b13265c..f41c492 100644 --- a/models/logging/LogstashAppender.cfc +++ b/models/logging/LogstashAppender.cfc @@ -123,10 +123,10 @@ component * Runs on registration */ public LogstashAppender function onRegistration() output=false{ - try{ + try { ensureDataStream(); variables._dataStreamAssured = true; - } catch( any e ){ + } catch ( any e ) { createObject( "java", "java.lang.System" ).err.println( "Unable to create data stream. The attempt to communicate with the Elasticsearch server returned: #e.message# - #e.detail#. Your ability to log messages with this appender may be compromised." ); @@ -138,11 +138,10 @@ component * Write an entry into the appender. */ public void function logMessage( required any logEvent ) output=false{ - - if( !variables._dataStreamAssured ){ + if ( !variables._dataStreamAssured ) { this.onRegistration(); // skip out if there was a communication failure - if( !variables._dataStreamAssured ){ + if ( !variables._dataStreamAssured ) { return; } } @@ -151,8 +150,11 @@ component try { var document = newDocument().new( index = getProperty( "dataStream" ), properties = logObj ); - if( getProperty( "async" ) ){ - variables.asyncManager.newFuture().withTimeout( getProperty( "asyncTimeout" ) ).run( () => document.create() ); + if ( getProperty( "async" ) ) { + variables.asyncManager + .newFuture() + .withTimeout( getProperty( "asyncTimeout" ) ) + .run( () => document.create() ); } else { document.create(); } @@ -166,12 +168,12 @@ component extraInfo = { "logData" : logObj, "exception" : e }, category = e.type ); - var appendersMap = application.wirebox.getLogbox().getAppenderRegistry(); + var appendersMap = application.wirebox.getLogbox().getAppenderRegistry(); // Log errors out to other appenders besides this one appendersMap .keyArray() .filter( function( key ){ - return lcase( key ) != lcase( getName() ); + return lCase( key ) != lCase( getName() ); } ) .each( function( appenderName ){ appendersMap[ appenderName ].logMessage( eLogEvent ); @@ -366,7 +368,9 @@ component if ( propertyExists( "lifecyclePolicy" ) ) { policyBuilder.setPhases( getProperty( "lifecyclePolicy" ) ); } else { - policyBuilder.hotPhase( rollover=getProperty( "rolloverSize" ) ).withDeletion( age = getProperty( "retentionDays" ) ); + policyBuilder + .hotPhase( rollover = getProperty( "rolloverSize" ) ) + .withDeletion( age = getProperty( "retentionDays" ) ); } policyBuilder.save(); @@ -407,7 +411,9 @@ component ], "data_stream" : {}, "priority" : getProperty( "indexTemplatePriority" ), - "_meta" : { "description" : "Index Template for cbElasticsearch Logs ( DataStream: #dataStreamName# )" } + "_meta" : { + "description" : "Index Template for cbElasticsearch Logs ( DataStream: #dataStreamName# )" + } } ); @@ -645,7 +651,7 @@ component "dynamic_templates" : [ { "user_info_fields" : { - "path_match" : "user.info.*", + "path_match" : "user.info.*", "match_mapping_type" : "string", "mapping" : { "type" : "text", @@ -682,17 +688,11 @@ component }, "error" : { "type" : "object", - "properties" : { - "extrainfo" : { "type" : "text" } - } + "properties" : { "extrainfo" : { "type" : "text" } } }, "message" : { "type" : "text", - "fields" : { - "keyword" : { - "type" : "keyword", "ignore_above" : 512 - } - } + "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 512 } } }, "event" : { "type" : "object", @@ -709,7 +709,7 @@ component "properties" : { "signature" : { "type" : "keyword" }, "isSuppressed" : { "type" : "boolean" }, - "assignment" : { "type" : "keyword" } + "assignment" : { "type" : "keyword" } } } }