This package enables you to use the package database with Elasticsearch, a text search engine based on Apache Lucene.
dependencies:
database: any
database_adapter_elasticsearch: any
import 'package:database/database.dart';
import 'package:database_adapter_elasticsearch/database_adapter_elasticsearch.dart';
// Set up
final Database database = ElasticSearch(
credentials: ElasticSearchPasswordCredentials(
user: 'example user',
password: 'example password'
),
);
Future main() async {
// Insert a document
final document = await database.collection('example').insert({
'greeting': 'Hello world!'
});
// Search documents
final results = await database.collection('example').search(
query: Query.parse(
'hello',
skip: 0,
take: 10,
)',
});
}