Source file values.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
(* generated by: awso-codegen generate-all --botocore-data vendor/botocore/botocore/data -o aws --runtime-dir lib/runtime/awso --cli-dir awso-cli *)
open Awso
open! Import
[@@@warning "-32"]
let service = Service.cloudsearchdomain
let apiVersion = "2013-01-01"
let endpointPrefix = "cloudsearchdomain"
let serviceFullName = "Amazon CloudSearch Domain"
let signatureVersion = "v4"
let protocol = "rest_json"
let globalEndpoint = endpointPrefix ^ ".amazonaws.com"
let simple_to_json to_value x =
  Botodata.Json.value_to_json_scalar (to_value x)
let composed_to_json to_value x = Botodata.Json.value_to_json (to_value x)
let to_query to_value x = Client.Query.of_value (to_value x)
let structure_to_value_aux st ~f =
  let filter = function | (k, Some v) -> Some (k, v) | _ -> None in
  let pair k v = (k, v) in
  let defer_value (k, dv) = pair k dv in
  ((List.filter_map st ~f:filter) |> (List.map ~f:defer_value)) |>
    (fun x -> `Structure (f x))
let structure_to_value = structure_to_value_aux ~f:Fn.id
let structure_to_wrapped_value ~wrapper ~response =
  structure_to_value_aux
    ~f:(fun x -> [(wrapper, (`Structure x)); (response, (`Structure []))])
module String_ =
  struct
    type nonrec t = string
    let context_ = "String"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"String" j
    let to_json = simple_to_json to_value
  end
module Long =
  struct
    type nonrec t = Int64.t
    let make i = i
    let of_string = Int64.of_string
    let to_value x = `Long x
    let to_query v = to_query to_value v
    let to_header x = Int64.to_string x
    let of_xml xml_arg0 =
      Int64.of_string (string_of_xml ~kind:"a long" xml_arg0)
    let of_json j = Int64.of_float (float_of_json ~kind:"a long" j)
    let to_json = simple_to_json to_value
  end
module FieldValue =
  struct
    type nonrec t = String_.t list
    let make i = i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:String_.to_value)) |> (fun x -> `List x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for List_shape objects" ()
    let of_xml x =
      make
        (List.map
           ((Xml.all_children x) |>
              (List.filter
                 ~f:(function
                     | `Data s ->
                         (match Stdlib.String.trim s with
                          | "" -> false
                          | _ -> true)
                     | _ -> true))) ~f:String_.of_xml)
    let of_json j =
      list_of_json ~kind:"FieldValue" ~of_json:String_.of_json j
    let to_json v = composed_to_json to_value v
  end
module Bucket =
  struct
    type nonrec t =
      {
      value: String_.t option [@ocaml.doc "The facet value being counted."];
      count: Long.t option
        [@ocaml.doc
          "The number of hits that contain the facet value in the specified facet field."]}
    let make ?value = fun ?count -> fun () -> { value; count }
    let to_value x =
      structure_to_value
        [("value", (Option.map x.value ~f:String_.to_value));
        ("count", (Option.map x.count ~f:Long.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let count = (Option.map ~f:Long.of_xml) (Xml.child xml_arg0 "count") in
      let value = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "value") in
      make ?count ?value ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let count = field_map json__ "count" Long.of_json in
      let value = field_map json__ "value" String_.of_json in
      make ?count ?value ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "A container for facet information."]
module Exprs =
  struct
    type nonrec t = (String_.t * String_.t) list
    let make i = i
    let of_header xs =
      make
        (List.filter_map xs
           ~f:(fun (k, v) ->
                 (Base.String.chop_prefix k ~prefix:"x-amz-meta-") |>
                   (Option.map
                      ~f:(fun chopped ->
                            ((String_.of_string chopped),
                              (String_.of_string v))))))
    let to_value xs =
      (xs |>
         (List.map
            ~f:(fun (x, y) ->
                  (String_.to_value x) |>
                    (fun x -> (String_.to_value y) |> (fun y -> (x, y))))))
        |> (fun x -> `Map x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for Map_shape objects" ()
    let of_xml _ =
      failwith "of_xml_converter_of_shape: Map_shape case not implemented"
    let of_json j =
      object_of_json ~key_of_string:String_.of_string
        ~of_json:String_.of_json j
    let to_json v = composed_to_json to_value v
  end
module Fields =
  struct
    type nonrec t = (String_.t * FieldValue.t) list
    let make i = i
    let of_header xs =
      make
        (List.filter_map xs
           ~f:(fun (k, v) ->
                 (Base.String.chop_prefix k ~prefix:"x-amz-meta-") |>
                   (Option.map
                      ~f:(fun chopped ->
                            let (_ : string) = v in
                            let (_ : string) = chopped in
                            failwith
                              "no of_header for complex types String FieldValue"))))
    let to_value xs =
      (xs |>
         (List.map
            ~f:(fun (x, y) ->
                  (String_.to_value x) |>
                    (fun x -> (FieldValue.to_value y) |> (fun y -> (x, y))))))
        |> (fun x -> `Map x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for Map_shape objects" ()
    let of_xml _ =
      failwith "of_xml_converter_of_shape: Map_shape case not implemented"
    let of_json j =
      object_of_json ~key_of_string:String_.of_string
        ~of_json:FieldValue.of_json j
    let to_json v = composed_to_json to_value v
  end
module Highlights =
  struct
    type nonrec t = (String_.t * String_.t) list
    let make i = i
    let of_header xs =
      make
        (List.filter_map xs
           ~f:(fun (k, v) ->
                 (Base.String.chop_prefix k ~prefix:"x-amz-meta-") |>
                   (Option.map
                      ~f:(fun chopped ->
                            ((String_.of_string chopped),
                              (String_.of_string v))))))
    let to_value xs =
      (xs |>
         (List.map
            ~f:(fun (x, y) ->
                  (String_.to_value x) |>
                    (fun x -> (String_.to_value y) |> (fun y -> (x, y))))))
        |> (fun x -> `Map x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for Map_shape objects" ()
    let of_xml _ =
      failwith "of_xml_converter_of_shape: Map_shape case not implemented"
    let of_json j =
      object_of_json ~key_of_string:String_.of_string
        ~of_json:String_.of_json j
    let to_json v = composed_to_json to_value v
  end
module SuggestionMatch =
  struct
    type nonrec t =
      {
      suggestion: String_.t option
        [@ocaml.doc
          "The string that matches the query string specified in the SuggestRequest."];
      score: Long.t option
        [@ocaml.doc "The relevance score of a suggested match."];
      id: String_.t option
        [@ocaml.doc "The document ID of the suggested document."]}
    let make ?suggestion =
      fun ?score -> fun ?id -> fun () -> { suggestion; score; id }
    let to_value x =
      structure_to_value
        [("suggestion", (Option.map x.suggestion ~f:String_.to_value));
        ("score", (Option.map x.score ~f:Long.to_value));
        ("id", (Option.map x.id ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let id = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "id") in
      let score = (Option.map ~f:Long.of_xml) (Xml.child xml_arg0 "score") in
      let suggestion =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "suggestion") in
      make ?id ?score ?suggestion ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let id = field_map json__ "id" String_.of_json in
      let score = field_map json__ "score" Long.of_json in
      let suggestion = field_map json__ "suggestion" String_.of_json in
      make ?id ?score ?suggestion ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "An autocomplete suggestion that matches the query string specified in a SuggestRequest."]
module BucketList =
  struct
    type nonrec t = Bucket.t list
    let make i = i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:Bucket.to_value)) |> (fun x -> `List x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for List_shape objects" ()
    let of_xml x =
      make
        (List.map
           ((Xml.all_children x) |>
              (List.filter
                 ~f:(function
                     | `Data s ->
                         (match Stdlib.String.trim s with
                          | "" -> false
                          | _ -> true)
                     | _ -> true))) ~f:Bucket.of_xml)
    let of_json j = list_of_json ~kind:"BucketList" ~of_json:Bucket.of_json j
    let to_json v = composed_to_json to_value v
  end
module Hit =
  struct
    type nonrec t =
      {
      id: String_.t option
        [@ocaml.doc
          "The document ID of a document that matches the search request."];
      fields: Fields.t option
        [@ocaml.doc
          "The fields returned from a document that matches the search request."];
      exprs: Exprs.t option
        [@ocaml.doc
          "The expressions returned from a document that matches the search request."];
      highlights: Highlights.t option
        [@ocaml.doc
          "The highlights returned from a document that matches the search request."]}
    let make ?id =
      fun ?fields ->
        fun ?exprs ->
          fun ?highlights -> fun () -> { id; fields; exprs; highlights }
    let to_value x =
      structure_to_value
        [("id", (Option.map x.id ~f:String_.to_value));
        ("fields", (Option.map x.fields ~f:Fields.to_value));
        ("exprs", (Option.map x.exprs ~f:Exprs.to_value));
        ("highlights", (Option.map x.highlights ~f:Highlights.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let highlights =
        (Option.map ~f:Highlights.of_xml) (Xml.child xml_arg0 "highlights") in
      let exprs = (Option.map ~f:Exprs.of_xml) (Xml.child xml_arg0 "exprs") in
      let fields =
        (Option.map ~f:Fields.of_xml) (Xml.child xml_arg0 "fields") in
      let id = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "id") in
      make ?highlights ?exprs ?fields ?id ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let highlights = field_map json__ "highlights" Highlights.of_json in
      let exprs = field_map json__ "exprs" Exprs.of_json in
      let fields = field_map json__ "fields" Fields.of_json in
      let id = field_map json__ "id" String_.of_json in
      make ?highlights ?exprs ?fields ?id ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Information about a document that matches the search request."]
module Double =
  struct
    type nonrec t = float
    let make i = i
    let of_string = Float.of_string
    let to_value x = `Double x
    let to_query v = to_query to_value v
    let to_header x = Stdlib.Float.to_string x
    let of_xml xml_arg0 =
      Float.of_string (string_of_xml ~kind:"a double" xml_arg0)
    let of_json j = float_of_json ~kind:"a double" j
    let to_json = simple_to_json to_value
  end
module DocumentServiceWarning =
  struct
    type nonrec t =
      {
      message: String_.t option
        [@ocaml.doc
          "The description for a warning returned by the document service."]}
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "message" String_.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "A warning returned by the document service when an issue is discovered while processing an upload request."]
module Suggestions =
  struct
    type nonrec t = SuggestionMatch.t list
    let make i = i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:SuggestionMatch.to_value)) |> (fun x -> `List x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for List_shape objects" ()
    let of_xml x =
      make
        (List.map
           ((Xml.all_children x) |>
              (List.filter
                 ~f:(function
                     | `Data s ->
                         (match Stdlib.String.trim s with
                          | "" -> false
                          | _ -> true)
                     | _ -> true))) ~f:SuggestionMatch.of_xml)
    let of_json j =
      list_of_json ~kind:"Suggestions" ~of_json:SuggestionMatch.of_json j
    let to_json v = composed_to_json to_value v
  end
module BucketInfo =
  struct
    type nonrec t =
      {
      buckets: BucketList.t option
        [@ocaml.doc "A list of the calculated facet values and counts."]}
    let make ?buckets = fun () -> { buckets }
    let to_value x =
      structure_to_value
        [("buckets", (Option.map x.buckets ~f:BucketList.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let buckets =
        (Option.map ~f:BucketList.of_xml) (Xml.child xml_arg0 "buckets") in
      make ?buckets ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let buckets = field_map json__ "buckets" BucketList.of_json in
      make ?buckets ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "A container for the calculated facet values and counts."]
module HitList =
  struct
    type nonrec t = Hit.t list
    let make i = i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:Hit.to_value)) |> (fun x -> `List x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for List_shape objects" ()
    let of_xml x =
      make
        (List.map
           ((Xml.all_children x) |>
              (List.filter
                 ~f:(function
                     | `Data s ->
                         (match Stdlib.String.trim s with
                          | "" -> false
                          | _ -> true)
                     | _ -> true))) ~f:Hit.of_xml)
    let of_json j = list_of_json ~kind:"HitList" ~of_json:Hit.of_json j
    let to_json v = composed_to_json to_value v
  end
module FieldStats =
  struct
    type nonrec t =
      {
      min: String_.t option
        [@ocaml.doc
          "The minimum value found in the specified field in the result set. If the field is numeric (int, int-array, double, or double-array), min is the string representation of a double-precision 64-bit floating point value. If the field is date or date-array, min is the string representation of a date with the format specified in IETF RFC3339: yyyy-mm-ddTHH:mm:ss.SSSZ."];
      max: String_.t option
        [@ocaml.doc
          "The maximum value found in the specified field in the result set. If the field is numeric (int, int-array, double, or double-array), max is the string representation of a double-precision 64-bit floating point value. If the field is date or date-array, max is the string representation of a date with the format specified in IETF RFC3339: yyyy-mm-ddTHH:mm:ss.SSSZ."];
      count: Long.t option
        [@ocaml.doc
          "The number of documents that contain a value in the specified field in the result set."];
      missing: Long.t option
        [@ocaml.doc
          "The number of documents that do not contain a value in the specified field in the result set."];
      sum: Double.t option
        [@ocaml.doc
          "The sum of the field values across the documents in the result set. null for date fields."];
      sumOfSquares: Double.t option
        [@ocaml.doc "The sum of all field values in the result set squared."];
      mean: String_.t option
        [@ocaml.doc
          "The average of the values found in the specified field in the result set. If the field is numeric (int, int-array, double, or double-array), mean is the string representation of a double-precision 64-bit floating point value. If the field is date or date-array, mean is the string representation of a date with the format specified in IETF RFC3339: yyyy-mm-ddTHH:mm:ss.SSSZ."];
      stddev: Double.t option
        [@ocaml.doc
          "The standard deviation of the values in the specified field in the result set."]}
    let make ?min =
      fun ?max ->
        fun ?count ->
          fun ?missing ->
            fun ?sum ->
              fun ?sumOfSquares ->
                fun ?mean ->
                  fun ?stddev ->
                    fun () ->
                      {
                        min;
                        max;
                        count;
                        missing;
                        sum;
                        sumOfSquares;
                        mean;
                        stddev
                      }
    let to_value x =
      structure_to_value
        [("min", (Option.map x.min ~f:String_.to_value));
        ("max", (Option.map x.max ~f:String_.to_value));
        ("count", (Option.map x.count ~f:Long.to_value));
        ("missing", (Option.map x.missing ~f:Long.to_value));
        ("sum", (Option.map x.sum ~f:Double.to_value));
        ("sumOfSquares", (Option.map x.sumOfSquares ~f:Double.to_value));
        ("mean", (Option.map x.mean ~f:String_.to_value));
        ("stddev", (Option.map x.stddev ~f:Double.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let stddev =
        (Option.map ~f:Double.of_xml) (Xml.child xml_arg0 "stddev") in
      let mean = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "mean") in
      let sumOfSquares =
        (Option.map ~f:Double.of_xml) (Xml.child xml_arg0 "sumOfSquares") in
      let sum = (Option.map ~f:Double.of_xml) (Xml.child xml_arg0 "sum") in
      let missing =
        (Option.map ~f:Long.of_xml) (Xml.child xml_arg0 "missing") in
      let count = (Option.map ~f:Long.of_xml) (Xml.child xml_arg0 "count") in
      let max = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "max") in
      let min = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "min") in
      make ?stddev ?mean ?sumOfSquares ?sum ?missing ?count ?max ?min ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let stddev = field_map json__ "stddev" Double.of_json in
      let mean = field_map json__ "mean" String_.of_json in
      let sumOfSquares = field_map json__ "sumOfSquares" Double.of_json in
      let sum = field_map json__ "sum" Double.of_json in
      let missing = field_map json__ "missing" Long.of_json in
      let count = field_map json__ "count" Long.of_json in
      let max = field_map json__ "max" String_.of_json in
      let min = field_map json__ "min" String_.of_json in
      make ?stddev ?mean ?sumOfSquares ?sum ?missing ?count ?max ?min ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "The statistics for a field calculated in the request."]
module Adds =
  struct
    type nonrec t = Int64.t
    let make i = i
    let of_string = Int64.of_string
    let to_value x = `Long x
    let to_query v = to_query to_value v
    let to_header x = Int64.to_string x
    let of_xml xml_arg0 =
      Int64.of_string (string_of_xml ~kind:"a long" xml_arg0)
    let of_json j = Int64.of_float (float_of_json ~kind:"a long" j)
    let to_json = simple_to_json to_value
  end
module Deletes =
  struct
    type nonrec t = Int64.t
    let make i = i
    let of_string = Int64.of_string
    let to_value x = `Long x
    let to_query v = to_query to_value v
    let to_header x = Int64.to_string x
    let of_xml xml_arg0 =
      Int64.of_string (string_of_xml ~kind:"a long" xml_arg0)
    let of_json j = Int64.of_float (float_of_json ~kind:"a long" j)
    let to_json = simple_to_json to_value
  end
module DocumentServiceException =
  struct
    type nonrec t =
      {
      status: String_.t option
        [@ocaml.doc
          "The return status of a document upload request, error or success."];
      message: String_.t option
        [@ocaml.doc
          "The description of the errors returned by the document service."]}
    let make ?status = fun ?message -> fun () -> { status; message }
    let to_value x =
      structure_to_value
        [("status", (Option.map x.status ~f:String_.to_value));
        ("message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "message") in
      let status =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "status") in
      make ?message ?status ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "message" String_.of_json in
      let status = field_map json__ "status" String_.of_json in
      make ?message ?status ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Information about any problems encountered while processing an upload request."]
module DocumentServiceWarnings =
  struct
    type nonrec t = DocumentServiceWarning.t list
    let make i = i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:DocumentServiceWarning.to_value)) |>
        (fun x -> `List x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for List_shape objects" ()
    let of_xml x =
      make
        (List.map
           ((Xml.all_children x) |>
              (List.filter
                 ~f:(function
                     | `Data s ->
                         (match Stdlib.String.trim s with
                          | "" -> false
                          | _ -> true)
                     | _ -> true))) ~f:DocumentServiceWarning.of_xml)
    let of_json j =
      list_of_json ~kind:"DocumentServiceWarnings"
        ~of_json:DocumentServiceWarning.of_json j
    let to_json v = composed_to_json to_value v
  end
module Blob =
  struct
    type nonrec t = string
    let make i = i
    let of_string x = x
    let to_value x = `Blob x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml xml_arg0 = string_of_xml ~kind:"a blob" xml_arg0
    let of_json j = string_of_json ~kind:"a blob" j
    let to_json = simple_to_json to_value
  end
module ContentType =
  struct
    type nonrec t =
      | Application_json 
      | Application_xml 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | Application_json -> "application/json"
      | Application_xml -> "application/xml"
      | Non_static_id s -> s
    let of_string =
      function
      | "application/json" -> Application_json
      | "application/xml" -> Application_xml
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string (string_of_xml ~kind:"enumeration ContentType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"ContentType" j)
    let to_json = simple_to_json to_value
  end
module SearchException =
  struct
    type nonrec t =
      {
      message: String_.t option
        [@ocaml.doc
          "A description of the error returned by the search service."]}
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "message" String_.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Information about any problems encountered while processing a search request."]
module SuggestModel =
  struct
    type nonrec t =
      {
      query: String_.t option
        [@ocaml.doc "The query string specified in the suggest request."];
      found: Long.t option
        [@ocaml.doc
          "The number of documents that were found to match the query string."];
      suggestions: Suggestions.t option
        [@ocaml.doc "The documents that match the query string."]}
    let make ?query =
      fun ?found ->
        fun ?suggestions -> fun () -> { query; found; suggestions }
    let to_value x =
      structure_to_value
        [("query", (Option.map x.query ~f:String_.to_value));
        ("found", (Option.map x.found ~f:Long.to_value));
        ("suggestions", (Option.map x.suggestions ~f:Suggestions.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let suggestions =
        (Option.map ~f:Suggestions.of_xml) (Xml.child xml_arg0 "suggestions") in
      let found = (Option.map ~f:Long.of_xml) (Xml.child xml_arg0 "found") in
      let query = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "query") in
      make ?suggestions ?found ?query ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let suggestions = field_map json__ "suggestions" Suggestions.of_json in
      let found = field_map json__ "found" Long.of_json in
      let query = field_map json__ "query" String_.of_json in
      make ?suggestions ?found ?query ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Container for the suggestion information returned in a SuggestResponse."]
module SuggestStatus =
  struct
    type nonrec t =
      {
      timems: Long.t option
        [@ocaml.doc
          "How long it took to process the request, in milliseconds."];
      rid: String_.t option
        [@ocaml.doc "The encrypted resource ID for the request."]}
    let make ?timems = fun ?rid -> fun () -> { timems; rid }
    let to_value x =
      structure_to_value
        [("timems", (Option.map x.timems ~f:Long.to_value));
        ("rid", (Option.map x.rid ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let rid = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "rid") in
      let timems = (Option.map ~f:Long.of_xml) (Xml.child xml_arg0 "timems") in
      make ?rid ?timems ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let rid = field_map json__ "rid" String_.of_json in
      let timems = field_map json__ "timems" Long.of_json in
      make ?rid ?timems ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Contains the resource id (rid) and the time it took to process the request (timems)."]
module Query =
  struct
    type nonrec t = string
    let context_ = "Query"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Query" j
    let to_json = simple_to_json to_value
  end
module Suggester =
  struct
    type nonrec t = string
    let context_ = "Suggester"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Suggester" j
    let to_json = simple_to_json to_value
  end
module SuggestionsSize =
  struct
    type nonrec t = Int64.t
    let make i = i
    let of_string = Int64.of_string
    let to_value x = `Long x
    let to_query v = to_query to_value v
    let to_header x = Int64.to_string x
    let of_xml xml_arg0 =
      Int64.of_string (string_of_xml ~kind:"a long" xml_arg0)
    let of_json j = Int64.of_float (float_of_json ~kind:"a long" j)
    let to_json = simple_to_json to_value
  end
module Facets =
  struct
    type nonrec t = (String_.t * BucketInfo.t) list
    let make i = i
    let of_header xs =
      make
        (List.filter_map xs
           ~f:(fun (k, v) ->
                 (Base.String.chop_prefix k ~prefix:"x-amz-meta-") |>
                   (Option.map
                      ~f:(fun chopped ->
                            let (_ : string) = v in
                            let (_ : string) = chopped in
                            failwith
                              "no of_header for complex types String BucketInfo"))))
    let to_value xs =
      (xs |>
         (List.map
            ~f:(fun (x, y) ->
                  (String_.to_value x) |>
                    (fun x -> (BucketInfo.to_value y) |> (fun y -> (x, y))))))
        |> (fun x -> `Map x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for Map_shape objects" ()
    let of_xml _ =
      failwith "of_xml_converter_of_shape: Map_shape case not implemented"
    let of_json j =
      object_of_json ~key_of_string:String_.of_string
        ~of_json:BucketInfo.of_json j
    let to_json v = composed_to_json to_value v
  end
module Hits =
  struct
    type nonrec t =
      {
      found: Long.t option
        [@ocaml.doc
          "The total number of documents that match the search request."];
      start: Long.t option
        [@ocaml.doc "The index of the first matching document."];
      cursor: String_.t option
        [@ocaml.doc
          "A cursor that can be used to retrieve the next set of matching documents when you want to page through a large result set."];
      hit: HitList.t option
        [@ocaml.doc "A document that matches the search request."]}
    let make ?found =
      fun ?start ->
        fun ?cursor -> fun ?hit -> fun () -> { found; start; cursor; hit }
    let to_value x =
      structure_to_value
        [("found", (Option.map x.found ~f:Long.to_value));
        ("start", (Option.map x.start ~f:Long.to_value));
        ("cursor", (Option.map x.cursor ~f:String_.to_value));
        ("hit", (Option.map x.hit ~f:HitList.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let hit = (Option.map ~f:HitList.of_xml) (Xml.child xml_arg0 "hit") in
      let cursor =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "cursor") in
      let start = (Option.map ~f:Long.of_xml) (Xml.child xml_arg0 "start") in
      let found = (Option.map ~f:Long.of_xml) (Xml.child xml_arg0 "found") in
      make ?hit ?cursor ?start ?found ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let hit = field_map json__ "hit" HitList.of_json in
      let cursor = field_map json__ "cursor" String_.of_json in
      let start = field_map json__ "start" Long.of_json in
      let found = field_map json__ "found" Long.of_json in
      make ?hit ?cursor ?start ?found ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The collection of documents that match the search request."]
module SearchStatus =
  struct
    type nonrec t =
      {
      timems: Long.t option
        [@ocaml.doc
          "How long it took to process the request, in milliseconds."];
      rid: String_.t option
        [@ocaml.doc "The encrypted resource ID for the request."]}
    let make ?timems = fun ?rid -> fun () -> { timems; rid }
    let to_value x =
      structure_to_value
        [("timems", (Option.map x.timems ~f:Long.to_value));
        ("rid", (Option.map x.rid ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let rid = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "rid") in
      let timems = (Option.map ~f:Long.of_xml) (Xml.child xml_arg0 "timems") in
      make ?rid ?timems ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let rid = field_map json__ "rid" String_.of_json in
      let timems = field_map json__ "timems" Long.of_json in
      make ?rid ?timems ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Contains the resource id (rid) and the time it took to process the request (timems)."]
module Stats =
  struct
    type nonrec t = (String_.t * FieldStats.t) list
    let make i = i
    let of_header xs =
      make
        (List.filter_map xs
           ~f:(fun (k, v) ->
                 (Base.String.chop_prefix k ~prefix:"x-amz-meta-") |>
                   (Option.map
                      ~f:(fun chopped ->
                            let (_ : string) = v in
                            let (_ : string) = chopped in
                            failwith
                              "no of_header for complex types String FieldStats"))))
    let to_value xs =
      (xs |>
         (List.map
            ~f:(fun (x, y) ->
                  (String_.to_value x) |>
                    (fun x -> (FieldStats.to_value y) |> (fun y -> (x, y))))))
        |> (fun x -> `Map x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for Map_shape objects" ()
    let of_xml _ =
      failwith "of_xml_converter_of_shape: Map_shape case not implemented"
    let of_json j =
      object_of_json ~key_of_string:String_.of_string
        ~of_json:FieldStats.of_json j
    let to_json v = composed_to_json to_value v
  end
module Cursor =
  struct
    type nonrec t = string
    let context_ = "Cursor"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Cursor" j
    let to_json = simple_to_json to_value
  end
module Expr =
  struct
    type nonrec t = string
    let context_ = "Expr"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Expr" j
    let to_json = simple_to_json to_value
  end
module Facet =
  struct
    type nonrec t = string
    let context_ = "Facet"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Facet" j
    let to_json = simple_to_json to_value
  end
module FilterQuery =
  struct
    type nonrec t = string
    let context_ = "FilterQuery"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"FilterQuery" j
    let to_json = simple_to_json to_value
  end
module Highlight =
  struct
    type nonrec t = string
    let context_ = "Highlight"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Highlight" j
    let to_json = simple_to_json to_value
  end
module Partial =
  struct
    type nonrec t = bool
    let make i = i
    let of_string = Bool.of_string
    let to_value x = `Boolean x
    let to_query v = to_query to_value v
    let to_header x = Bool.to_string x
    let of_xml xml_arg0 =
      Bool.of_string (string_of_xml ~kind:"a boolean" xml_arg0)
    let of_json = bool_of_json
    let to_json = simple_to_json to_value
  end
module QueryOptions =
  struct
    type nonrec t = string
    let context_ = "QueryOptions"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"QueryOptions" j
    let to_json = simple_to_json to_value
  end
module QueryParser =
  struct
    type nonrec t =
      | Simple 
      | Structured 
      | Lucene 
      | Dismax 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | Simple -> "simple"
      | Structured -> "structured"
      | Lucene -> "lucene"
      | Dismax -> "dismax"
      | Non_static_id s -> s
    let of_string =
      function
      | "simple" -> Simple
      | "structured" -> Structured
      | "lucene" -> Lucene
      | "dismax" -> Dismax
      | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string (string_of_xml ~kind:"enumeration QueryParser" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"QueryParser" j)
    let to_json = simple_to_json to_value
  end
module Return =
  struct
    type nonrec t = string
    let context_ = "Return"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Return" j
    let to_json = simple_to_json to_value
  end
module Size =
  struct
    type nonrec t = Int64.t
    let make i = i
    let of_string = Int64.of_string
    let to_value x = `Long x
    let to_query v = to_query to_value v
    let to_header x = Int64.to_string x
    let of_xml xml_arg0 =
      Int64.of_string (string_of_xml ~kind:"a long" xml_arg0)
    let of_json j = Int64.of_float (float_of_json ~kind:"a long" j)
    let to_json = simple_to_json to_value
  end
module Sort =
  struct
    type nonrec t = string
    let context_ = "Sort"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Sort" j
    let to_json = simple_to_json to_value
  end
module Start =
  struct
    type nonrec t = Int64.t
    let make i = i
    let of_string = Int64.of_string
    let to_value x = `Long x
    let to_query v = to_query to_value v
    let to_header x = Int64.to_string x
    let of_xml xml_arg0 =
      Int64.of_string (string_of_xml ~kind:"a long" xml_arg0)
    let of_json j = Int64.of_float (float_of_json ~kind:"a long" j)
    let to_json = simple_to_json to_value
  end
module Stat =
  struct
    type nonrec t = string
    let context_ = "Stat"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Stat" j
    let to_json = simple_to_json to_value
  end
module UploadDocumentsResponse =
  struct
    type nonrec t =
      {
      status: String_.t option
        [@ocaml.doc "The status of an UploadDocumentsRequest."];
      adds: Adds.t option
        [@ocaml.doc
          "The number of documents that were added to the search domain."];
      deletes: Deletes.t option
        [@ocaml.doc
          "The number of documents that were deleted from the search domain."];
      warnings: DocumentServiceWarnings.t option
        [@ocaml.doc
          "Any warnings returned by the document service about the documents being uploaded."]}
    type nonrec error =
      [ `DocumentServiceException of DocumentServiceException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?status =
      fun ?adds ->
        fun ?deletes ->
          fun ?warnings -> fun () -> { status; adds; deletes; warnings }
    let error_of_json name json =
      match name with
      | "DocumentServiceException" ->
          `DocumentServiceException (DocumentServiceException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "DocumentServiceException" ->
          `DocumentServiceException (DocumentServiceException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `DocumentServiceException e ->
          `Assoc
            [("error", (`String "DocumentServiceException"));
            ("details", (DocumentServiceException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("status", (Option.map x.status ~f:String_.to_value));
        ("adds", (Option.map x.adds ~f:Adds.to_value));
        ("deletes", (Option.map x.deletes ~f:Deletes.to_value));
        ("warnings",
          (Option.map x.warnings ~f:DocumentServiceWarnings.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let warnings =
        (Option.map ~f:DocumentServiceWarnings.of_xml)
          (Xml.child xml_arg0 "warnings") in
      let deletes =
        (Option.map ~f:Deletes.of_xml) (Xml.child xml_arg0 "deletes") in
      let adds = (Option.map ~f:Adds.of_xml) (Xml.child xml_arg0 "adds") in
      let status =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "status") in
      make ?warnings ?deletes ?adds ?status ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let warnings =
        field_map json__ "warnings" DocumentServiceWarnings.of_json in
      let deletes = field_map json__ "deletes" Deletes.of_json in
      let adds = field_map json__ "adds" Adds.of_json in
      let status = field_map json__ "status" String_.of_json in
      make ?warnings ?deletes ?adds ?status ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Contains the response to an UploadDocuments request."]
module UploadDocumentsRequest =
  struct
    type nonrec t =
      {
      documents: Blob.t
        [@ocaml.doc "A batch of documents formatted in JSON or HTML."];
      contentType: ContentType.t
        [@ocaml.doc
          "The format of the batch you are uploading. Amazon CloudSearch supports two document batch formats: application/json application/xml"]}
    let context_ = "UploadDocumentsRequest"
    let make ~documents =
      fun ~contentType -> fun () -> { documents; contentType }
    let of_header_and_body =
      ((fun (xs, pipe) ->
          make ~documents:pipe
            ~contentType:(ContentType.of_string
                            ((List.Assoc.find_exn
                                ~equal:String.Caseless.equal) xs
                               "Content-Type")) ())
      [@warning "-27"])
    let to_value x =
      structure_to_value
        [("documents", (Some (Blob.to_value x.documents)));
        ("Content-Type", (Some (ContentType.to_value x.contentType)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let contentType =
        ContentType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "Content-Type") in
      let documents =
        Blob.of_xml (Xml.child_exn ~context:context_ xml_arg0 "documents") in
      make ~contentType ~documents ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let contentType =
        field_map_exn json__ "contentType" ContentType.of_json in
      let documents = field_map_exn json__ "documents" Blob.of_json in
      make ~contentType ~documents ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Container for the parameters to the UploadDocuments request."]
module SuggestResponse =
  struct
    type nonrec t =
      {
      status: SuggestStatus.t option
        [@ocaml.doc
          "The status of a SuggestRequest. Contains the resource ID (rid) and how long it took to process the request (timems)."];
      suggest: SuggestModel.t option
        [@ocaml.doc
          "Container for the matching search suggestion information."]}
    type nonrec error =
      [ `SearchException of SearchException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?status = fun ?suggest -> fun () -> { status; suggest }
    let error_of_json name json =
      match name with
      | "SearchException" -> `SearchException (SearchException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "SearchException" -> `SearchException (SearchException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `SearchException e ->
          `Assoc
            [("error", (`String "SearchException"));
            ("details", (SearchException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("status", (Option.map x.status ~f:SuggestStatus.to_value));
        ("suggest", (Option.map x.suggest ~f:SuggestModel.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let suggest =
        (Option.map ~f:SuggestModel.of_xml) (Xml.child xml_arg0 "suggest") in
      let status =
        (Option.map ~f:SuggestStatus.of_xml) (Xml.child xml_arg0 "status") in
      make ?suggest ?status ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let suggest = field_map json__ "suggest" SuggestModel.of_json in
      let status = field_map json__ "status" SuggestStatus.of_json in
      make ?suggest ?status ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Contains the response to a Suggest request."]
module SuggestRequest =
  struct
    type nonrec t =
      {
      query: Query.t
        [@ocaml.doc
          "Specifies the string for which you want to get suggestions."];
      suggester: Suggester.t
        [@ocaml.doc
          "Specifies the name of the suggester to use to find suggested matches."];
      size: SuggestionsSize.t option
        [@ocaml.doc "Specifies the maximum number of suggestions to return."]}
    let context_ = "SuggestRequest"
    let make ?size =
      fun ~query -> fun ~suggester -> fun () -> { size; query; suggester }
    let to_value x =
      structure_to_value
        [("q", (Some (Query.to_value x.query)));
        ("suggester", (Some (Suggester.to_value x.suggester)));
        ("size", (Option.map x.size ~f:SuggestionsSize.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let size =
        (Option.map ~f:SuggestionsSize.of_xml) (Xml.child xml_arg0 "size") in
      let suggester =
        Suggester.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "suggester") in
      let query = Query.of_xml (Xml.child_exn ~context:context_ xml_arg0 "q") in
      make ?size ~suggester ~query ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let size = field_map json__ "size" SuggestionsSize.of_json in
      let suggester = field_map_exn json__ "suggester" Suggester.of_json in
      let query = field_map_exn json__ "query" Query.of_json in
      make ?size ~suggester ~query ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Container for the parameters to the Suggest request."]
module SearchResponse =
  struct
    type nonrec t =
      {
      status: SearchStatus.t option
        [@ocaml.doc
          "The status information returned for the search request."];
      hits: Hits.t option
        [@ocaml.doc "The documents that match the search criteria."];
      facets: Facets.t option [@ocaml.doc "The requested facet information."];
      stats: Stats.t option
        [@ocaml.doc "The requested field statistics information."]}
    type nonrec error =
      [ `SearchException of SearchException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?status =
      fun ?hits ->
        fun ?facets ->
          fun ?stats -> fun () -> { status; hits; facets; stats }
    let error_of_json name json =
      match name with
      | "SearchException" -> `SearchException (SearchException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "SearchException" -> `SearchException (SearchException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `SearchException e ->
          `Assoc
            [("error", (`String "SearchException"));
            ("details", (SearchException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("status", (Option.map x.status ~f:SearchStatus.to_value));
        ("hits", (Option.map x.hits ~f:Hits.to_value));
        ("facets", (Option.map x.facets ~f:Facets.to_value));
        ("stats", (Option.map x.stats ~f:Stats.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let stats = (Option.map ~f:Stats.of_xml) (Xml.child xml_arg0 "stats") in
      let facets =
        (Option.map ~f:Facets.of_xml) (Xml.child xml_arg0 "facets") in
      let hits = (Option.map ~f:Hits.of_xml) (Xml.child xml_arg0 "hits") in
      let status =
        (Option.map ~f:SearchStatus.of_xml) (Xml.child xml_arg0 "status") in
      make ?stats ?facets ?hits ?status ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let stats = field_map json__ "stats" Stats.of_json in
      let facets = field_map json__ "facets" Facets.of_json in
      let hits = field_map json__ "hits" Hits.of_json in
      let status = field_map json__ "status" SearchStatus.of_json in
      make ?stats ?facets ?hits ?status ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The result of a Search request. Contains the documents that match the specified search criteria and any requested fields, highlights, and facet information."]
module SearchRequest =
  struct
    type nonrec t =
      {
      cursor: Cursor.t option
        [@ocaml.doc
          "Retrieves a cursor value you can use to page through large result sets. Use the size parameter to control the number of hits to include in each response. You can specify either the cursor or start parameter in a request; they are mutually exclusive. To get the first cursor, set the cursor value to initial. In subsequent requests, specify the cursor value returned in the hits section of the response. For more information, see Paginating Results in the Amazon CloudSearch Developer Guide."];
      expr: Expr.t option
        [@ocaml.doc
          "Defines one or more numeric expressions that can be used to sort results or specify search or filter criteria. You can also specify expressions as return fields. You specify the expressions in JSON using the form \\{\"EXPRESSIONNAME\":\"EXPRESSION\"\\}. You can define and use multiple expressions in a search request. For example: \\{\"expression1\":\"_score*rating\", \"expression2\":\"(1/rank)*year\"\\} For information about the variables, operators, and functions you can use in expressions, see Writing Expressions in the Amazon CloudSearch Developer Guide."];
      facet: Facet.t option
        [@ocaml.doc
          "Specifies one or more fields for which to get facet information, and options that control how the facet information is returned. Each specified field must be facet-enabled in the domain configuration. The fields and options are specified in JSON using the form \\{\"FIELD\":\\{\"OPTION\":VALUE,\"OPTION:\"STRING\"\\},\"FIELD\":\\{\"OPTION\":VALUE,\"OPTION\":\"STRING\"\\}\\}. You can specify the following faceting options: buckets specifies an array of the facet values or ranges to count. Ranges are specified using the same syntax that you use to search for a range of values. For more information, see Searching for a Range of Values in the Amazon CloudSearch Developer Guide. Buckets are returned in the order they are specified in the request. The sort and size options are not valid if you specify buckets. size specifies the maximum number of facets to include in the results. By default, Amazon CloudSearch returns counts for the top 10. The size parameter is only valid when you specify the sort option; it cannot be used in conjunction with buckets. sort specifies how you want to sort the facets in the results: bucket or count. Specify bucket to sort alphabetically or numerically by facet value (in ascending order). Specify count to sort by the facet counts computed for each facet value (in descending order). To retrieve facet counts for particular values or ranges of values, use the buckets option instead of sort. If no facet options are specified, facet counts are computed for all field values, the facets are sorted by facet count, and the top 10 facets are returned in the results. To count particular buckets of values, use the buckets option. For example, the following request uses the buckets option to calculate and return facet counts by decade. \\{\"year\":\\{\"buckets\":\\[\"\\[1970,1979\\]\",\"\\[1980,1989\\]\",\"\\[1990,1999\\]\",\"\\[2000,2009\\]\",\"\\[2010,\\}\"\\]\\}\\} To sort facets by facet count, use the count option. For example, the following request sets the sort option to count to sort the facet values by facet count, with the facet values that have the most matching documents listed first. Setting the size option to 3 returns only the top three facet values. \\{\"year\":\\{\"sort\":\"count\",\"size\":3\\}\\} To sort the facets by value, use the bucket option. For example, the following request sets the sort option to bucket to sort the facet values numerically by year, with earliest year listed first. \\{\"year\":\\{\"sort\":\"bucket\"\\}\\} For more information, see Getting and Using Facet Information in the Amazon CloudSearch Developer Guide."];
      filterQuery: FilterQuery.t option
        [@ocaml.doc
          "Specifies a structured query that filters the results of a search without affecting how the results are scored and sorted. You use filterQuery in conjunction with the query parameter to filter the documents that match the constraints specified in the query parameter. Specifying a filter controls only which matching documents are included in the results, it has no effect on how they are scored and sorted. The filterQuery parameter supports the full structured query syntax. For more information about using filters, see Filtering Matching Documents in the Amazon CloudSearch Developer Guide."];
      highlight: Highlight.t option
        [@ocaml.doc
          "Retrieves highlights for matches in the specified text or text-array fields. Each specified field must be highlight enabled in the domain configuration. The fields and options are specified in JSON using the form \\{\"FIELD\":\\{\"OPTION\":VALUE,\"OPTION:\"STRING\"\\},\"FIELD\":\\{\"OPTION\":VALUE,\"OPTION\":\"STRING\"\\}\\}. You can specify the following highlight options: format: specifies the format of the data in the text field: text or html. When data is returned as HTML, all non-alphanumeric characters are encoded. The default is html. max_phrases: specifies the maximum number of occurrences of the search term(s) you want to highlight. By default, the first occurrence is highlighted. pre_tag: specifies the string to prepend to an occurrence of a search term. The default for HTML highlights is <em>. The default for text highlights is *. post_tag: specifies the string to append to an occurrence of a search term. The default for HTML highlights is </em>. The default for text highlights is *. If no highlight options are specified for a field, the returned field text is treated as HTML and the first match is highlighted with emphasis tags: <em>search-term</em>. For example, the following request retrieves highlights for the actors and title fields. \\{ \"actors\": \\{\\}, \"title\": \\{\"format\": \"text\",\"max_phrases\": 2,\"pre_tag\": \"\",\"post_tag\": \"\"\\} \\}"];
      partial: Partial.t option
        [@ocaml.doc
          "Enables partial results to be returned if one or more index partitions are unavailable. When your search index is partitioned across multiple search instances, by default Amazon CloudSearch only returns results if every partition can be queried. This means that the failure of a single search instance can result in 5xx (internal server) errors. When you enable partial results, Amazon CloudSearch returns whatever results are available and includes the percentage of documents searched in the search results (percent-searched). This enables you to more gracefully degrade your users' search experience. For example, rather than displaying no results, you could display the partial results and a message indicating that the results might be incomplete due to a temporary system outage."];
      query: Query.t
        [@ocaml.doc
          "Specifies the search criteria for the request. How you specify the search criteria depends on the query parser used for the request and the parser options specified in the queryOptions parameter. By default, the simple query parser is used to process requests. To use the structured, lucene, or dismax query parser, you must also specify the queryParser parameter. For more information about specifying search criteria, see Searching Your Data in the Amazon CloudSearch Developer Guide."];
      queryOptions: QueryOptions.t option
        [@ocaml.doc
          "Configures options for the query parser specified in the queryParser parameter. You specify the options in JSON using the following form \\{\"OPTION1\":\"VALUE1\",\"OPTION2\":VALUE2\"...\"OPTIONN\":\"VALUEN\"\\}. The options you can configure vary according to which parser you use: defaultOperator: The default operator used to combine individual terms in the search string. For example: defaultOperator: 'or'. For the dismax parser, you specify a percentage that represents the percentage of terms in the search string (rounded down) that must match, rather than a default operator. A value of 0% is the equivalent to OR, and a value of 100% is equivalent to AND. The percentage must be specified as a value in the range 0-100 followed by the percent (%) symbol. For example, defaultOperator: 50%. Valid values: and, or, a percentage in the range 0%-100% (dismax). Default: and (simple, structured, lucene) or 100 (dismax). Valid for: simple, structured, lucene, and dismax. fields: An array of the fields to search when no fields are specified in a search. If no fields are specified in a search and this option is not specified, all text and text-array fields are searched. You can specify a weight for each field to control the relative importance of each field when Amazon CloudSearch calculates relevance scores. To specify a field weight, append a caret (^) symbol and the weight to the field name. For example, to boost the importance of the title field over the description field you could specify: \"fields\":\\[\"title^5\",\"description\"\\]. Valid values: The name of any configured field and an optional numeric value greater than zero. Default: All text and text-array fields. Valid for: simple, structured, lucene, and dismax. operators: An array of the operators or special characters you want to disable for the simple query parser. If you disable the and, or, or not operators, the corresponding operators (+, |, -) have no special meaning and are dropped from the search string. Similarly, disabling prefix disables the wildcard operator (*) and disabling phrase disables the ability to search for phrases by enclosing phrases in double quotes. Disabling precedence disables the ability to control order of precedence using parentheses. Disabling near disables the ability to use the ~ operator to perform a sloppy phrase search. Disabling the fuzzy operator disables the ability to use the ~ operator to perform a fuzzy search. escape disables the ability to use a backslash (\\) to escape special characters within the search string. Disabling whitespace is an advanced option that prevents the parser from tokenizing on whitespace, which can be useful for Vietnamese. (It prevents Vietnamese words from being split incorrectly.) For example, you could disable all operators other than the phrase operator to support just simple term and phrase queries: \"operators\":\\[\"and\",\"not\",\"or\", \"prefix\"\\]. Valid values: and, escape, fuzzy, near, not, or, phrase, precedence, prefix, whitespace. Default: All operators and special characters are enabled. Valid for: simple. phraseFields: An array of the text or text-array fields you want to use for phrase searches. When the terms in the search string appear in close proximity within a field, the field scores higher. You can specify a weight for each field to boost that score. The phraseSlop option controls how much the matches can deviate from the search string and still be boosted. To specify a field weight, append a caret (^) symbol and the weight to the field name. For example, to boost phrase matches in the title field over the abstract field, you could specify: \"phraseFields\":\\[\"title^3\", \"plot\"\\] Valid values: The name of any text or text-array field and an optional numeric value greater than zero. Default: No fields. If you don't specify any fields with phraseFields, proximity scoring is disabled even if phraseSlop is specified. Valid for: dismax. phraseSlop: An integer value that specifies how much matches can deviate from the search phrase and still be boosted according to the weights specified in the phraseFields option; for example, phraseSlop: 2. You must also specify phraseFields to enable proximity scoring. Valid values: positive integers. Default: 0. Valid for: dismax. explicitPhraseSlop: An integer value that specifies how much a match can deviate from the search phrase when the phrase is enclosed in double quotes in the search string. (Phrases that exceed this proximity distance are not considered a match.) For example, to specify a slop of three for dismax phrase queries, you would specify \"explicitPhraseSlop\":3. Valid values: positive integers. Default: 0. Valid for: dismax. tieBreaker: When a term in the search string is found in a document's field, a score is calculated for that field based on how common the word is in that field compared to other documents. If the term occurs in multiple fields within a document, by default only the highest scoring field contributes to the document's overall score. You can specify a tieBreaker value to enable the matches in lower-scoring fields to contribute to the document's score. That way, if two documents have the same max field score for a particular term, the score for the document that has matches in more fields will be higher. The formula for calculating the score with a tieBreaker is (max field score) + (tieBreaker) * (sum of the scores for the rest of the matching fields). Set tieBreaker to 0 to disregard all but the highest scoring field (pure max): \"tieBreaker\":0. Set to 1 to sum the scores from all fields (pure sum): \"tieBreaker\":1. Valid values: 0.0 to 1.0. Default: 0.0. Valid for: dismax."];
      queryParser: QueryParser.t option
        [@ocaml.doc
          "Specifies which query parser to use to process the request. If queryParser is not specified, Amazon CloudSearch uses the simple query parser. Amazon CloudSearch supports four query parsers: simple: perform simple searches of text and text-array fields. By default, the simple query parser searches all text and text-array fields. You can specify which fields to search by with the queryOptions parameter. If you prefix a search term with a plus sign (+) documents must contain the term to be considered a match. (This is the default, unless you configure the default operator with the queryOptions parameter.) You can use the - (NOT), | (OR), and * (wildcard) operators to exclude particular terms, find results that match any of the specified terms, or search for a prefix. To search for a phrase rather than individual terms, enclose the phrase in double quotes. For more information, see Searching for Text in the Amazon CloudSearch Developer Guide. structured: perform advanced searches by combining multiple expressions to define the search criteria. You can also search within particular fields, search for values and ranges of values, and use advanced options such as term boosting, matchall, and near. For more information, see Constructing Compound Queries in the Amazon CloudSearch Developer Guide. lucene: search using the Apache Lucene query parser syntax. For more information, see Apache Lucene Query Parser Syntax. dismax: search using the simplified subset of the Apache Lucene query parser syntax defined by the DisMax query parser. For more information, see DisMax Query Parser Syntax."];
      return: Return.t option
        [@ocaml.doc
          "Specifies the field and expression values to include in the response. Multiple fields or expressions are specified as a comma-separated list. By default, a search response includes all return enabled fields (_all_fields). To return only the document IDs for the matching documents, specify _no_fields. To retrieve the relevance score calculated for each document, specify _score."];
      size: Size.t option
        [@ocaml.doc
          "Specifies the maximum number of search hits to include in the response."];
      sort: Sort.t option
        [@ocaml.doc
          "Specifies the fields or custom expressions to use to sort the search results. Multiple fields or expressions are specified as a comma-separated list. You must specify the sort direction (asc or desc) for each field; for example, year desc,title asc. To use a field to sort results, the field must be sort-enabled in the domain configuration. Array type fields cannot be used for sorting. If no sort parameter is specified, results are sorted by their default relevance scores in descending order: _score desc. You can also sort by document ID (_id asc) and version (_version desc). For more information, see Sorting Results in the Amazon CloudSearch Developer Guide."];
      start: Start.t option
        [@ocaml.doc
          "Specifies the offset of the first search hit you want to return. Note that the result set is zero-based; the first result is at index 0. You can specify either the start or cursor parameter in a request, they are mutually exclusive. For more information, see Paginating Results in the Amazon CloudSearch Developer Guide."];
      stats: Stat.t option
        [@ocaml.doc
          "Specifies one or more fields for which to get statistics information. Each specified field must be facet-enabled in the domain configuration. The fields are specified in JSON using the form: \\{\"FIELD-A\":\\{\\},\"FIELD-B\":\\{\\}\\} There are currently no options supported for statistics."]}
    let context_ = "SearchRequest"
    let make ?cursor =
      fun ?expr ->
        fun ?facet ->
          fun ?filterQuery ->
            fun ?highlight ->
              fun ?partial ->
                fun ?queryOptions ->
                  fun ?queryParser ->
                    fun ?return ->
                      fun ?size ->
                        fun ?sort ->
                          fun ?start ->
                            fun ?stats ->
                              fun ~query ->
                                fun () ->
                                  {
                                    cursor;
                                    expr;
                                    facet;
                                    filterQuery;
                                    highlight;
                                    partial;
                                    queryOptions;
                                    queryParser;
                                    return;
                                    size;
                                    sort;
                                    start;
                                    stats;
                                    query
                                  }
    let to_value x =
      structure_to_value
        [("cursor", (Option.map x.cursor ~f:Cursor.to_value));
        ("expr", (Option.map x.expr ~f:Expr.to_value));
        ("facet", (Option.map x.facet ~f:Facet.to_value));
        ("fq", (Option.map x.filterQuery ~f:FilterQuery.to_value));
        ("highlight", (Option.map x.highlight ~f:Highlight.to_value));
        ("partial", (Option.map x.partial ~f:Partial.to_value));
        ("q", (Some (Query.to_value x.query)));
        ("q.options", (Option.map x.queryOptions ~f:QueryOptions.to_value));
        ("q.parser", (Option.map x.queryParser ~f:QueryParser.to_value));
        ("return", (Option.map x.return ~f:Return.to_value));
        ("size", (Option.map x.size ~f:Size.to_value));
        ("sort", (Option.map x.sort ~f:Sort.to_value));
        ("start", (Option.map x.start ~f:Start.to_value));
        ("stats", (Option.map x.stats ~f:Stat.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let stats = (Option.map ~f:Stat.of_xml) (Xml.child xml_arg0 "stats") in
      let start = (Option.map ~f:Start.of_xml) (Xml.child xml_arg0 "start") in
      let sort = (Option.map ~f:Sort.of_xml) (Xml.child xml_arg0 "sort") in
      let size = (Option.map ~f:Size.of_xml) (Xml.child xml_arg0 "size") in
      let return =
        (Option.map ~f:Return.of_xml) (Xml.child xml_arg0 "return") in
      let queryParser =
        (Option.map ~f:QueryParser.of_xml) (Xml.child xml_arg0 "q.parser") in
      let queryOptions =
        (Option.map ~f:QueryOptions.of_xml) (Xml.child xml_arg0 "q.options") in
      let query = Query.of_xml (Xml.child_exn ~context:context_ xml_arg0 "q") in
      let partial =
        (Option.map ~f:Partial.of_xml) (Xml.child xml_arg0 "partial") in
      let highlight =
        (Option.map ~f:Highlight.of_xml) (Xml.child xml_arg0 "highlight") in
      let filterQuery =
        (Option.map ~f:FilterQuery.of_xml) (Xml.child xml_arg0 "fq") in
      let facet = (Option.map ~f:Facet.of_xml) (Xml.child xml_arg0 "facet") in
      let expr = (Option.map ~f:Expr.of_xml) (Xml.child xml_arg0 "expr") in
      let cursor =
        (Option.map ~f:Cursor.of_xml) (Xml.child xml_arg0 "cursor") in
      make ?stats ?start ?sort ?size ?return ?queryParser ?queryOptions
        ~query ?partial ?highlight ?filterQuery ?facet ?expr ?cursor ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let stats = field_map json__ "stats" Stat.of_json in
      let start = field_map json__ "start" Start.of_json in
      let sort = field_map json__ "sort" Sort.of_json in
      let size = field_map json__ "size" Size.of_json in
      let return = field_map json__ "return" Return.of_json in
      let queryParser = field_map json__ "queryParser" QueryParser.of_json in
      let queryOptions = field_map json__ "queryOptions" QueryOptions.of_json in
      let query = field_map_exn json__ "query" Query.of_json in
      let partial = field_map json__ "partial" Partial.of_json in
      let highlight = field_map json__ "highlight" Highlight.of_json in
      let filterQuery = field_map json__ "filterQuery" FilterQuery.of_json in
      let facet = field_map json__ "facet" Facet.of_json in
      let expr = field_map json__ "expr" Expr.of_json in
      let cursor = field_map json__ "cursor" Cursor.of_json in
      make ?stats ?start ?sort ?size ?return ?queryParser ?queryOptions
        ~query ?partial ?highlight ?filterQuery ?facet ?expr ?cursor ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Container for the parameters to the Search request."]