CbElasticsearch

Past, Present, and Future

What Is CBElasticsearch?

What Is CBElasticsearch?

  • API wrapper for Elasticsearch
  • Brings the power of Elasticsearch to CFML

Last 12 Months

highlights from the last year of development

CBElasticsearch 1.1.3

  • Added .updateByQuery()
  • Ability to find and update documents via a script
var search = searchBuilder.filterTerm( "author", "Michael Borne" );

client.updateByQuery( search, {
    "script" : "ctx._source.author.name = 'Michael Born'",
    "lang" : "painless"
});

CBElasticsearch 1.2.0

  • Support for ES v7
  • New AliasBuilder
  • New .reindex() method
var client = getInstance( "Client@cbElasticsearch" );
var aliasBuilder = getInstance( "AliasBuilder@cbElasticSearch" );

// "pour" book documents into new library index
client.reindex( "books", "library" );

// create an alias of the old index name so no code errors out
client.applyAliases(
    aliasBuilder.add( "library", "books" )
);

CBElasticsearch 1.3.0

  • Support for ES tasks
  • New .getIndices() method
  • New .getAliases() method
var reindex = getInstance( "Client@cbElasticsearch" )
                        .reindex(
                            source = "books",
                            destination = "library",
                            waitForCompletion = false
                        );

while( !reindex.isComplete( delay=5000 ) ){
    var status = reindex.getStatus();
    writeOutput(
      "<p>Created #status.created# documents of #status.total#</p>"
    );
    flush();
}

CBElasticsearch 1.4.0

  • Support for ES query suggestions
  • "Did You Mean" via suggestTerm()
  • Autocomplete via suggestCompletion()
var search = getInstance( "SearchBuilder@cbElasticsearch" )
             .suggestTerm( "Carl Perlins", "artistName" )
             .execute();
var search = getInstance( "SearchBuilder@cbElasticsearch" )
             .suggestCompletion( "Is Elvis still", "artistName" )
             .execute();

Next 12 Months

The future roadmap

Nested Queries

  • Allow nesting searchBuilder objects
  • Improves support for complex queries
  • Allows reusing common queries

Ingest Support

  • Add support for indexing attachments
  • .pdf
  • .docx
  • .ppt

Index Snapshots

  • SnapshotBuilder
  • Allows creating index snapshot
  • Allows restoring from snapshot

Integration with CB Futures

We can improve asynchronous operations by integrating with ColdBox 6 futures

var client = getInstance( "Client@cbElasticsearch" );

client.saveAll(
    documents = persons,
    asFuture = true
  ).then( () => {
    getLogBox().getRootLogger().info( "Finished indexing documents" );
  });

Thank You!

Gavin Pickin

Introducing

Made with Slides.com