database_adapter_elasticsearch 0.2.2
database_adapter_elasticsearch: ^0.2.2 copied to clipboard

Adapter between 'package:database' and Elasticsearch, a full-featured text search engine based on Apache Lucene.

example/example.dart

import 'package:database/database.dart';
import 'package:database_adapter_elasticsearch/database_adapter_elasticsearch.dart';

Future main() async {
  // Set up
  final database = ElasticSearch(
    host: 'localhost',
    credentials: ElasticSearchPasswordCredentials(
      user: 'example user',
      password: 'example password',
    ),
  ).database();
  final collection = database.collection('example');

  // Insert a document
  final document = await collection.insert(data: {'greeting': 'Hello world!'});
  print('Inserted ID: ${document.documentId}');

  // Search documents
  final results = await collection.search(
    query: Query.parse(
      'world hello',
      skip: 0,
      take: 10,
    ),
  );
  print('Found ${results.items} results');
}
3
likes
90
pub points
9%
popularity

Publisher

dint.dev

Adapter between 'package:database' and Elasticsearch, a full-featured text search engine based on Apache Lucene.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

built_value, collection, database, meta, universal_io

More

Packages that depend on database_adapter_elasticsearch