elastic_client 0.1.8

Dart bindings for ElasticSearch HTTP API. #

ElasticSearch is a full-text search engine based on Lucene.

0.1.8 #

  • Query.prefix

0.1.7 #

  • Handle 'hits': {'total': {'value': 1}}} in the search response format.

0.1.6 #

  • Fix HTTP transport: preserve original uri's relative path segments.

0.1.5 #

  • Add dynamic source param for Client.search() method. This is a replacement for the boolean fetchSource to allow _source to be a boolean, a string or a list of strings as per the Elasticsearch spec.
  • Deprecate fetchSource param in the Client.search() method.
  • Support sorting of search results.

0.1.4 #

  • Fixed _mergeHeader function.
  • Using pedantic analysis options.

0.1.3 #

  • Upgrade http_client dependency.

0.1.2 #

  • BasicAuth option for HttpTransport.

0.1.1 #

  • Support suggest queries.

0.1.0 #

  • First public version.

example/example.dart

import 'package:elastic_client/console_http_transport.dart';
import 'package:elastic_client/elastic_client.dart' as elastic;

main() async {
  final transport =
      new ConsoleHttpTransport(Uri.parse('http://localhost:9200/'));
  final client = new elastic.Client(transport);

  await client.updateDoc('my_index', 'my_type', 'my_id_1', {'some': 'data', 'name':'Sue', 'distance': 10});
  await client.updateDoc('my_index', 'my_type', 'my_id_2', {'some': 'data', 'name':'Bob', 'distance': 20});
  await client.updateDoc('my_index', 'my_type', 'my_id_3', {'some': 'data', 'name':'Joe', 'distance': 10});
  await client.flushIndex('my_index');

  final rs1 = await client.search(
      'my_index',
      'my_type',
      elastic.Query.term('some', ['data']),
      source: true
    );
  print(rs1.toMap());

  print("---");

  final rs2 = await client.search(
      'my_index',
      'my_type',
      elastic.Query.term('some', ['data']),
      source: ['some', 'name'],
      sort: [{ "distance" : "asc" }, { "name.keyword" : "asc" }]
    );
  print(rs2.toMap());

  await transport.close();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  elastic_client: ^0.1.8

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:elastic_client/elastic_client.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
73
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
86
Learn more about scoring.

We analyzed this package on Sep 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:elastic_client/elastic_client.dart.

Health issues and suggestions

Document public APIs. (-1 points)

81 out of 81 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
http_client ^1.0.0 1.3.1
Transitive dependencies
async 2.3.0
buffer 1.0.6
charcode 1.1.2
collection 1.14.12
executor 2.2.0
http 0.12.0+2
http_parser 3.1.3
meta 1.1.7
path 1.6.4
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
pedantic ^1.0.0 1.8.0+1
test ^1.0.0