"Fossies" - the Fresh Open Source Software Archive

Member "elasticsearch-6.8.23/rest-api-spec/src/main/resources/rest-api-spec/test/range/10_basic.yml" (29 Dec 2021, 11079 Bytes) of package /linux/www/elasticsearch-6.8.23-src.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ansible YAML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 setup:
    2   - do:
    3       indices.create:
    4           index: test
    5           body:
    6             settings:
    7               number_of_replicas: 0
    8             mappings:
    9               doc:
   10                 "properties":
   11                   "integer_range":
   12                      "type" : "integer_range"
   13                   "long_range":
   14                      "type" : "long_range"
   15                   "float_range":
   16                      "type" : "float_range"
   17                   "double_range":
   18                      "type" : "double_range"
   19                   "date_range":
   20                      "type" : "date_range"
   21                   "ip_range":
   22                      "type" : "ip_range"
   23 
   24 ---
   25 "Integer range":
   26 
   27   - do:
   28       index:
   29         index: test
   30         type: doc
   31         id: 1
   32         body: { "integer_range" : { "gte": 1, "lte": 5 } }
   33 
   34   - do:
   35       index:
   36         index: test
   37         type: doc
   38         id: 2
   39         body: { "integer_range" : { "gte": 1, "lte": 3 } }
   40 
   41   - do:
   42       index:
   43         index: test
   44         type: doc
   45         id: 3
   46         body: { "integer_range" : { "gte": 4, "lte": 5 } }
   47 
   48   - do:
   49       indices.refresh: {}
   50 
   51   - do:
   52       search:
   53         body: { "size" : 0, "query" : { "range" : { "integer_range" : { "gte": 3, "lte" : 4 } } } }
   54 
   55   - match: { hits.total: 3 }
   56 
   57   - do:
   58       search:
   59         body: { "size" : 0, "query" : { "range" : { "integer_range" : { "gte": 3, "lte" : 4, "relation": "intersects" } } } }
   60 
   61   - match: { hits.total: 3 }
   62 
   63   - do:
   64       search:
   65         body: { "size" : 0, "query" : { "range" : { "integer_range" : { "gte": 3, "lte" : 4, "relation": "contains" } } } }
   66 
   67   - match: { hits.total: 1 }
   68 
   69   - do:
   70       search:
   71         body: { "size" : 0, "query" : { "range" : { "integer_range" : { "gte": 3, "lte" : 4, "relation": "within" } } } }
   72 
   73   - match: { hits.total: 0 }
   74 
   75 ---
   76 "Add document with null value":
   77   - skip:
   78       version: " - 6.1.99"
   79       reason: ignoring null values on range fields was introduced in 6.2.0
   80   - do:
   81       index:
   82         index: test
   83         type: doc
   84         id: 1
   85         body: { "integer_range" : { "gte": 1, "lte": 5 } }
   86 
   87   - do:
   88       index:
   89         index: test
   90         type: doc
   91         id: 2
   92         body: { "integer_range" : { "gte": 1, "lte": 3 } }
   93 
   94   - do:
   95       index:
   96         index: test
   97         type: doc
   98         id: 3
   99         body: { "integer_range" : { "gte": 4, "lte": 5 } }
  100 
  101   - do:
  102       index:
  103         index: test
  104         type: doc
  105         id: 4
  106         body: { "integer_range" : null }
  107 
  108   - do:
  109       indices.refresh: {}
  110 
  111   - do:
  112       search:
  113         body: { "query" : { "match_all": {} } }
  114 
  115   - match: { hits.total: 4 }
  116 
  117 ---
  118 "Long range":
  119 
  120   - do:
  121       index:
  122         index: test
  123         type: doc
  124         id: 1
  125         body: { "long_range" : { "gte": 1, "lte": 5 } }
  126 
  127   - do:
  128       index:
  129         index: test
  130         type: doc
  131         id: 2
  132         body: { "long_range" : { "gte": 1, "lte": 3 } }
  133 
  134   - do:
  135       index:
  136         index: test
  137         type: doc
  138         id: 3
  139         body: { "long_range" : { "gte": 4, "lte": 5 } }
  140 
  141 
  142   - do:
  143       indices.refresh: {}
  144 
  145   - do:
  146       search:
  147         body: { "size" : 0, "query" : { "range" : { "long_range" : { "gte": 3, "lte" : 4 } } } }
  148 
  149   - match: { hits.total: 3 }
  150 
  151   - do:
  152       search:
  153         body: { "size" : 0, "query" : { "range" : { "long_range" : { "gte": 3, "lte" : 4, "relation": "intersects" } } } }
  154 
  155   - match: { hits.total: 3 }
  156 
  157   - do:
  158       search:
  159         body: { "size" : 0, "query" : { "range" : { "long_range" : { "gte": 3, "lte" : 4, "relation": "contains" } } } }
  160 
  161   - match: { hits.total: 1 }
  162 
  163   - do:
  164       search:
  165         body: { "size" : 0, "query" : { "range" : { "long_range" : { "gte": 3, "lte" : 4, "relation": "within" } } } }
  166 
  167   - match: { hits.total: 0 }
  168 
  169 ---
  170 "Float range":
  171 
  172   - do:
  173       index:
  174         index: test
  175         type: doc
  176         id: 1
  177         body: { "float_range" : { "gte": 1, "lte": 5 } }
  178 
  179   - do:
  180       index:
  181         index: test
  182         type: doc
  183         id: 2
  184         body: { "float_range" : { "gte": 1, "lte": 3 } }
  185 
  186   - do:
  187       index:
  188         index: test
  189         type: doc
  190         id: 3
  191         body: { "float_range" : { "gte": 4, "lte": 5 } }
  192 
  193 
  194   - do:
  195       indices.refresh: {}
  196 
  197   - do:
  198       search:
  199         body: { "size" : 0, "query" : { "range" : { "float_range" : { "gte": 3, "lte" : 4 } } } }
  200 
  201   - match: { hits.total: 3 }
  202 
  203   - do:
  204       search:
  205         body: { "size" : 0, "query" : { "range" : { "float_range" : { "gte": 3, "lte" : 4, "relation": "intersects" } } } }
  206 
  207   - match: { hits.total: 3 }
  208 
  209   - do:
  210       search:
  211         body: { "size" : 0, "query" : { "range" : { "float_range" : { "gte": 3, "lte" : 4, "relation": "contains" } } } }
  212 
  213   - match: { hits.total: 1 }
  214 
  215   - do:
  216       search:
  217         body: { "size" : 0, "query" : { "range" : { "float_range" : { "gte": 3, "lte" : 4, "relation": "within" } } } }
  218 
  219   - match: { hits.total: 0 }
  220 
  221 ---
  222 "Double range":
  223 
  224   - do:
  225       index:
  226         index: test
  227         type: doc
  228         id: 1
  229         body: { "double_range" : { "gte": 1, "lte": 5 } }
  230 
  231   - do:
  232       index:
  233         index: test
  234         type: doc
  235         id: 2
  236         body: { "double_range" : { "gte": 1, "lte": 3 } }
  237 
  238   - do:
  239       index:
  240         index: test
  241         type: doc
  242         id: 3
  243         body: { "double_range" : { "gte": 4, "lte": 5 } }
  244 
  245 
  246   - do:
  247       indices.refresh: {}
  248 
  249   - do:
  250       search:
  251         body: { "size" : 0, "query" : { "range" : { "double_range" : { "gte": 3, "lte" : 4 } } } }
  252 
  253   - match: { hits.total: 3 }
  254 
  255   - do:
  256       search:
  257         body: { "size" : 0, "query" : { "range" : { "double_range" : { "gte": 3, "lte" : 4, "relation": "intersects" } } } }
  258 
  259   - match: { hits.total: 3 }
  260 
  261   - do:
  262       search:
  263         body: { "size" : 0, "query" : { "range" : { "double_range" : { "gte": 3, "lte" : 4, "relation": "contains" } } } }
  264 
  265   - match: { hits.total: 1 }
  266 
  267   - do:
  268       search:
  269         body: { "size" : 0, "query" : { "range" : { "double_range" : { "gte": 3, "lte" : 4, "relation": "within" } } } }
  270 
  271   - match: { hits.total: 0 }
  272 
  273 ---
  274 "IP range":
  275 
  276   - do:
  277       index:
  278         index: test
  279         type: doc
  280         id: 1
  281         body: { "ip_range" : { "gte": "192.168.0.1", "lte": "192.168.0.5" } }
  282 
  283   - do:
  284       index:
  285         index: test
  286         type: doc
  287         id: 2
  288         body: { "ip_range" : { "gte": "192.168.0.1", "lte": "192.168.0.3" } }
  289 
  290   - do:
  291       index:
  292         index: test
  293         type: doc
  294         id: 3
  295         body: { "ip_range" : { "gte": "192.168.0.4", "lte": "192.168.0.5" } }
  296 
  297 
  298   - do:
  299       indices.refresh: {}
  300 
  301   - do:
  302       search:
  303         body: { "size" : 0, "query" : { "range" : { "ip_range" : { "gte": "192.168.0.3", "lte" : "192.168.0.4" } } } }
  304 
  305   - match: { hits.total: 3 }
  306 
  307   - do:
  308       search:
  309         body: { "size" : 0, "query" : { "range" : { "ip_range" : { "gte": "192.168.0.3", "lte" : "192.168.0.4", "relation": "intersects" } } } }
  310 
  311   - match: { hits.total: 3 }
  312 
  313   - do:
  314       search:
  315         body: { "size" : 0, "query" : { "range" : { "ip_range" : { "gte": "192.168.0.3", "lte" : "192.168.0.4", "relation": "contains" } } } }
  316 
  317   - match: { hits.total: 1 }
  318 
  319   - do:
  320       search:
  321         body: { "size" : 0, "query" : { "range" : { "ip_range" : { "gte": "192.168.0.3", "lte" : "192.168.0.4", "relation": "within" } } } }
  322 
  323   - match: { hits.total: 0 }
  324 
  325 ---
  326 "Date range":
  327 
  328   - do:
  329       index:
  330         index: test
  331         type: doc
  332         id: 1
  333         body: { "date_range" : { "gte": "2017-09-01", "lte": "2017-09-05" } }
  334 
  335   - do:
  336       index:
  337         index: test
  338         type: doc
  339         id: 2
  340         body: { "date_range" : { "gte": "2017-09-01", "lte": "2017-09-03" } }
  341 
  342   - do:
  343       index:
  344         index: test
  345         type: doc
  346         id: 3
  347         body: { "date_range" : { "gte": "2017-09-04", "lte": "2017-09-05" } }
  348 
  349 
  350   - do:
  351       indices.refresh: {}
  352 
  353   - do:
  354       search:
  355         body: { "size" : 0, "query" : { "range" : { "date_range" : { "gte": "2017-09-03", "lte" : "2017-09-04" } } } }
  356 
  357   - match: { hits.total: 3 }
  358 
  359   - do:
  360       search:
  361         body: { "size" : 0, "query" : { "range" : { "date_range" : { "gte": "2017-09-03", "lte" : "2017-09-04", "relation": "intersects" } } } }
  362 
  363   - match: { hits.total: 3 }
  364 
  365   - do:
  366       search:
  367         body: { "size" : 0, "query" : { "range" : { "date_range" : { "gte": "2017-09-03", "lte" : "2017-09-04", "relation": "contains" } } } }
  368 
  369   - match: { hits.total: 1 }
  370 
  371   - do:
  372       search:
  373         body: { "size" : 0, "query" : { "range" : { "date_range" : { "gte": "2017-09-03", "lte" : "2017-09-04", "relation": "within" } } } }
  374 
  375   - match: { hits.total: 0 }
  376 
  377 ---
  378 "Query on range fields in query_string":
  379 
  380   - skip:
  381       version:  " - 6.0.99"
  382       reason: "Support for range field in query_string was introduced in 6.1 (#26552)"
  383 
  384   - do:
  385       index:
  386         index: test
  387         type: doc
  388         id: 1
  389         body: { "integer_range" : { "gte": 1, "lte": 5 },
  390                 "long_range" : { "gte": 1, "lte": 5 },
  391                 "float_range" : { "gte": 1, "lte": 5 },
  392                 "double_range" : { "gte": 1, "lte": 5 },
  393                 "ip_range" : { "gte": "192.168.0.1", "lte": "192.168.0.5" },
  394                 "date_range" : { "gte": "2017-09-01", "lte": "2017-09-05" }
  395               }
  396 
  397   - do:
  398       index:
  399         index: test
  400         type: doc
  401         id: 2
  402         body: { "integer_range" : { "gte": 1, "lte": 3 },
  403                 "long_range" : { "gte": 1, "lte": 3 },
  404                 "float_range" : { "gte": 1, "lte": 3 },
  405                 "double_range" : { "gte": 1, "lte":3 },
  406                 "ip_range" : { "gte": "192.168.0.1", "lte": "192.168.0.3" },
  407                 "date_range" : { "gte": "2017-09-01", "lte": "2017-09-03" } 
  408               }
  409 
  410   - do:
  411       index:
  412         index: test
  413         type: doc
  414         id: 3
  415         body: { "integer_range" : { "gte": 4, "lte": 5 },
  416                 "long_range" : { "gte": 4, "lte": 5 },
  417                 "float_range" : { "gte": 4, "lte": 5 },
  418                 "double_range" : { "gte": 4, "lte":5 },
  419                 "ip_range" : { "gte": "192.168.0.4", "lte": "192.168.0.5" },
  420                 "date_range" : { "gte": "2017-09-04", "lte": "2017-09-05" } 
  421               }
  422 
  423   - do:
  424       indices.refresh: {}
  425 
  426   - do:
  427       search:
  428         body: { "size" : 0, "query" : { "query_string" : { "query" : "integer_range:[3 TO 4]" } } }
  429 
  430   - match: { hits.total: 3 }
  431 
  432   - do:
  433       search:
  434         body: { "size" : 0, "query" : { "query_string" : { "query" : "long_range:[3 TO 4]" } } }
  435 
  436   - match: { hits.total: 3 }
  437   
  438   - do:
  439       search:
  440         body: { "size" : 0, "query" : { "query_string" : { "query" : "float_range:[3 TO 4]" } } }
  441 
  442   - match: { hits.total: 3 }
  443   
  444   - do:
  445       search:
  446         body: { "size" : 0, "query" : { "query_string" : { "query" : "double_range:[3 TO 4]" } } }
  447 
  448   - match: { hits.total: 3 }
  449   
  450   - do:
  451       search:
  452         body: { "size" : 0, "query" : { "query_string" : { "query" : "ip_range:[192.168.0.3 TO 192.168.0.4]" } } }
  453 
  454   - match: { hits.total: 3 }
  455   
  456   - do:
  457       search:
  458         body: { "size" : 0, "query" : { "query_string" : { "query" : "date_range:[2017-09-03 TO 2017-09-04]" } } }
  459 
  460   - match: { hits.total: 3 }