@@ -70,6 +70,8 @@ let fail_lwt fmt =
7070 Lwt. fail ErrorExit
7171 end fmt
7272
73+ let default_doc_type = " _doc"
74+
7375type 't json_reader = J .lexer_state -> Lexing .lexbuf -> 't
7476
7577type 't json_writer = Bi_outbuf .t -> 't -> unit
@@ -91,8 +93,8 @@ let es6_config = {
9193let es7_config = {
9294 read_total = Elastic_j. read_total;
9395 write_total = Elastic_j. write_total;
94- default_get_doc_type = " _doc " ;
95- default_put_doc_type = Some " _doc " ;
96+ default_get_doc_type = default_doc_type ;
97+ default_put_doc_type = Some default_doc_type ;
9698}
9799
98100let rec coalesce = function Some _ as hd :: _ -> hd | None :: tl -> coalesce tl | [] -> None
@@ -106,14 +108,15 @@ let get_es_version { verbose; _ } host =
106108 | "5" :: _ -> Lwt. return `ES5
107109 | "6" :: _ -> Lwt. return `ES6
108110 | "7" :: _ -> Lwt. return `ES7
111+ | "8" :: _ -> Lwt. return `ES8
109112 | other :: _ ->
110113 match int_of_string other with
111114 | exception exn -> Exn_lwt. fail ~exn " invalid ES version number : %s" number
112115 | _ -> Exn_lwt. fail " unsupported ES version number : %s" number
113116
114117let get_es_version_config' = function
115118 | `ES5 | `ES6 -> es6_config
116- | `ES7 -> es7_config
119+ | `ES7 | `ES8 -> es7_config
117120
118121let get_es_version_config common_args host es_version { Config_t. version = config_version ; _ } cluster_version =
119122 let version = coalesce [ es_version; cluster_version; config_version; ] in
@@ -183,9 +186,10 @@ let string_of_hit_format = function
183186
184187let map_of_hit_format =
185188 let open Elastic_t in function
186- | `FullID -> (fun ({ index; doc_type; id; _ } : 'a Elastic_t.option_hit ) -> sprintf " /%s/%s/%s" index doc_type id)
189+ | `FullID -> (fun ({ index; doc_type; id; _ } : 'a Elastic_t.option_hit ) ->
190+ sprintf " /%s/%s/%s" index (Option. default default_doc_type doc_type) id)
187191 | `ID -> (fun hit -> hit.id)
188- | `Type -> (fun hit -> hit.doc_type)
192+ | `Type -> (fun hit -> Option. default default_doc_type hit.doc_type)
189193 | `Index -> (fun hit -> hit.index)
190194 | `Routing -> (fun hit -> Option. default " " hit.routing)
191195 | `Hit -> (fun hit -> Elastic_j. string_of_option_hit J. write_json hit)
@@ -1544,6 +1548,7 @@ let common_args =
15441548 Some `ES5 , Arg. info [ " 5" ; ] ~docs ~doc: " force ES version 5.x" ;
15451549 Some `ES6 , Arg. info [ " 6" ; ] ~docs ~doc: " force ES version 6.x" ;
15461550 Some `ES7 , Arg. info [ " 7" ; ] ~docs ~doc: " force ES version 7.x" ;
1551+ Some `ES8 , Arg. info [ " 8" ; ] ~docs ~doc: " force ES version 8.x" ;
15471552 ])
15481553 in
15491554 let verbose =
0 commit comments