elastic_client 0.1.9

  • Readme
  • Changelog
  • Example
  • Installing
  • 83

Dart bindings for ElasticSearch HTTP API. #

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

0.1.9 #

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.9

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]
89
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Jan 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health issues and suggestions

Document public APIs. (-1 points)

110 out of 110 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.

Fix lib/src/elastic_client_impl.dart. (-8.17 points)

Analysis of lib/src/elastic_client_impl.dart reported 17 hints, including:

line 36 col 38: Unnecessary new keyword.

line 41 col 27: Unnecessary new keyword.

line 45 col 27: Unnecessary new keyword.

line 50 col 38: Unnecessary new keyword.

line 59 col 31: Unnecessary new keyword.

Fix lib/src/http_transport.dart. (-1 points)

Analysis of lib/src/http_transport.dart reported 2 hints:

line 28 col 15: Unnecessary new keyword.

line 35 col 12: Unnecessary new keyword.

Fix lib/console_http_transport.dart. (-0.50 points)

Analysis of lib/console_http_transport.dart reported 1 hint:

line 10 col 15: Unnecessary new keyword.

Fix lib/src/transport.dart. (-0.50 points)

Analysis of lib/src/transport.dart reported 1 hint:

line 29 col 12: Unnecessary new keyword.

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.4.0
buffer 1.0.6
charcode 1.1.2
collection 1.14.12
executor 2.2.0
http 0.12.0+4
http_parser 3.1.3
meta 1.1.8
path 1.6.4
source_span 1.6.0
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.9.0
test ^1.0.0