updateDoc method

Future<bool> updateDoc({
  1. required String index,
  2. required Map<String, dynamic> doc,
  3. String? type,
  4. String? id,
  5. bool merge = false,
})

Update doc in index.

Implementation

Future<bool> updateDoc({
  required String index,
  required Map<String, dynamic> doc,
  String? type,
  String? id,
  bool merge = false,
}) async {
  final pathSegments = <String>[
    index,
    if (type != null) type,
    if (merge) '_update',
    if (id != null) id,
  ];
  final rs =
      await _transport.send(Request('POST', pathSegments, bodyMap: doc));
  return rs.statusCode == 200 || rs.statusCode == 201;
}