elastic_client
elastic_client copied to clipboard
Write example
Please write example on (elastic_client) DART from my python code.
q = {
"query": {
"multi_match": {
"query": "John*",
"fields": "*"
}
}
}
res = es.search(index="kpmi_etalon_obj", body=q)
print("Got %d Hits:" % res['hits']['total']['value'])
for hit in res['hits']['hits']:
print(hit['_source']['etalonId'])
final _transport = ConsoleHttpTransport(Uri.parse('http://test.ru:9200/'));
String query = '''{
"query": {
"multi_match": {
"query": "John*",
"fields": "*"
}
}
}''';
final response = await _transport.send(Request('POST', ['kpmi_etalon_obj','_search'], bodyText: query));
if (response.statusCode == 200) {
var result = response.bodyAsMap;
countElements = result['hits']['total']['value'];
_elements = result['hits']['hits'];
_elements.forEach((element) {
final record = ElementList(
id: element['_id'],
title: element['_source']['project']['name'],
);
items.add(record);
});
Decided so but this is a mega perversion for your library.
Decided so but this is a mega perversion for your library.
I'm open for API changes and suggestions of improvements (also PRs are welcome!).