@opra/elastic
v1.28.5
Published
Opra Elastic Search adapter package
Readme
@opra/elastic
Elasticsearch data service adapter for the OPRA framework
🌐 Documentation · 🚀 Getting Started · 📦 Packages · 💬 Issues
Elasticsearch data service adapter for the OPRA framework. Translate OPRA operations directly into Elasticsearch queries — no manual query building required.
Features
ElasticService— Base service managing Elasticsearch client connection and error handlingElasticCollectionService— Collection-level CRUD service for Elasticsearch indicesElasticEntityService— Document-level service for single entity operationsElasticAdapter— Utility namespace:prepareFilter(),preparePatch(),prepareProjection(),prepareSort(),parseRequest()- Automatic translation of OPRA filter DSL to Elasticsearch query DSL
- Interceptor pipeline support
Installation
npm install @opra/elasticUsage
import { ElasticCollectionService } from '@opra/elastic';
import { Client } from '@elastic/elasticsearch';
@HttpController({ path: 'products' })
export class ProductsController extends ElasticCollectionService<Product> {
constructor(client: Client) {
super(Product, client, 'products');
}
@HttpOperation.Entity.FindMany({ type: Product })
findMany() { return super.findMany(); }
}Node Compatibility
- node >= 20.x
License
Available under MIT license.
