Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 15.47 KB | None | 0 0
  1. curl 'http://localhost:9200/?pretty'
  2. {
  3.   "name" : "John Jameson",
  4.   "cluster_name" : "elasticsearch_artem.bikov",
  5.   "version" : {
  6.     "number" : "2.3.4",
  7.     "build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f",
  8.     "build_timestamp" : "2016-06-30T11:24:31Z",
  9.     "build_snapshot" : false,
  10.     "lucene_version" : "5.5.0"
  11.   },
  12.   "tagline" : "You Know, for Search"
  13. }
  14. ➜  ~ curl 'http://localhost:9200/?pretty'
  15. {
  16.   "name" : "John Jameson",
  17.   "cluster_name" : "elasticsearch_artem.bikov",
  18.   "version" : {
  19.     "number" : "2.3.4",
  20.     "build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f",
  21.     "build_timestamp" : "2016-06-30T11:24:31Z",
  22.     "build_snapshot" : false,
  23.     "lucene_version" : "5.5.0"
  24.   },
  25.   "tagline" : "You Know, for Search"
  26. }
  27. ➜  ~ curl -XPUT "http://localhost:9200/releadgion/user_action/1?pretty" -d'{ "type": "registration", "attributes": { "email": "test@test.ru", "source": "direct" } }'
  28. {
  29.   "_index" : "releadgion",
  30.   "_type" : "user_action",
  31.   "_id" : "1",
  32.   "_version" : 1,
  33.   "_shards" : {
  34.     "total" : 2,
  35.     "successful" : 1,
  36.     "failed" : 0
  37.   },
  38.   "created" : true
  39. }
  40. ➜  ~ curl -XPUT "http://localhost:9200/releadgion/user_action/2?pretty" -d'{ "type": "campaign_created", "attributes": { "email": "test@test.ru", "campaign_id": 12, "platform": "my_target" } }'
  41. {
  42.   "_index" : "releadgion",
  43.   "_type" : "user_action",
  44.   "_id" : "2",
  45.   "_version" : 1,
  46.   "_shards" : {
  47.     "total" : 2,
  48.     "successful" : 1,
  49.     "failed" : 0
  50.   },
  51.   "created" : true
  52. }
  53. ➜  ~ curl -XPUT "http://localhost:9200/releadgion/user_action/3?pretty" -d'{ "type": "advert_stopped", "attributes": { "email": "test@test.ru", "campaign_id": 12, "advert_id": 44 } }'
  54. {
  55.   "_index" : "releadgion",
  56.   "_type" : "user_action",
  57.   "_id" : "3",
  58.   "_version" : 1,
  59.   "_shards" : {
  60.     "total" : 2,
  61.     "successful" : 1,
  62.     "failed" : 0
  63.   },
  64.   "created" : true
  65. }
  66. ➜  ~ curl -XPUT "http://localhost:9200/releadgion/user_action/1?pretty" -d'{ "type": "registration", "email": "test@test.ru", "source": "direct" }'
  67. {
  68.   "_index" : "releadgion",
  69.   "_type" : "user_action",
  70.   "_id" : "1",
  71.   "_version" : 2,
  72.   "_shards" : {
  73.     "total" : 2,
  74.     "successful" : 1,
  75.     "failed" : 0
  76.   },
  77.   "created" : false
  78. }
  79. ➜  ~ curl -XPUT "http://localhost:9200/releadgion/user_action/1?pretty" -d'{ "type": "registration", "email": "test@test.ru", "source": "direct" }'
  80. {
  81.   "_index" : "releadgion",
  82.   "_type" : "user_action",
  83.   "_id" : "1",
  84.   "_version" : 3,
  85.   "_shards" : {
  86.     "total" : 2,
  87.     "successful" : 1,
  88.     "failed" : 0
  89.   },
  90.   "created" : false
  91. }
  92. ➜  ~ curl -XPATCH "http://localhost:9200/releadgion/user_action/1?pretty" -d'{ "type": "registration", "email": "test@test.ru", "source": "direct" }'
  93. {
  94.   "_index" : "releadgion",
  95.   "_type" : "user_action",
  96.   "_id" : "1",
  97.   "_version" : 3,
  98.   "found" : true,
  99.   "_source" : {
  100.     "type" : "registration",
  101.     "email" : "test@test.ru",
  102.     "source" : "direct"
  103.   }
  104. }
  105. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/1?pretty"
  106. {
  107.   "_index" : "releadgion",
  108.   "_type" : "user_action",
  109.   "_id" : "1",
  110.   "_version" : 3,
  111.   "found" : true,
  112.   "_source" : {
  113.     "type" : "registration",
  114.     "email" : "test@test.ru",
  115.     "source" : "direct"
  116.   }
  117. }
  118. ➜  ~ curl -XPATCH "http://localhost:9200/releadgion/user_action/2?pretty" -d'{ "type": "campaign_created", "email": "test@test.ru", "campaign_id": 12, "platform": "my_target" }'
  119. {
  120.   "_index" : "releadgion",
  121.   "_type" : "user_action",
  122.   "_id" : "2",
  123.   "_version" : 1,
  124.   "found" : true,
  125.   "_source" : {
  126.     "type" : "campaign_created",
  127.     "attributes" : {
  128.       "email" : "test@test.ru",
  129.       "campaign_id" : 12,
  130.       "platform" : "my_target"
  131.     }
  132.   }
  133. }
  134. ➜  ~ curl -XPATCH "http://localhost:9200/releadgion/user_action/3?pretty" -d'{ "type": "advert_stopped", "email": "test@test.ru", "campaign_id": 12, "advert_id": 44 }'
  135. {
  136.   "_index" : "releadgion",
  137.   "_type" : "user_action",
  138.   "_id" : "3",
  139.   "_version" : 1,
  140.   "found" : true,
  141.   "_source" : {
  142.     "type" : "advert_stopped",
  143.     "attributes" : {
  144.       "email" : "test@test.ru",
  145.       "campaign_id" : 12,
  146.       "advert_id" : 44
  147.     }
  148.   }
  149. }
  150. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  151. quote> {
  152. quote>   "filter": {
  153. quote>     "term": {
  154. quote>       "email": "test@test.ru"
  155. quote>     }
  156. quote>   }
  157. quote> }'
  158. {
  159.   "took" : 197,
  160.   "timed_out" : false,
  161.   "_shards" : {
  162.     "total" : 5,
  163.     "successful" : 5,
  164.     "failed" : 0
  165.   },
  166.   "hits" : {
  167.     "total" : 0,
  168.     "max_score" : null,
  169.     "hits" : [ ]
  170.   }
  171. }
  172. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/1?pretty"
  173. {
  174.   "_index" : "releadgion",
  175.   "_type" : "user_action",
  176.   "_id" : "1",
  177.   "_version" : 3,
  178.   "found" : true,
  179.   "_source" : {
  180.     "type" : "registration",
  181.     "email" : "test@test.ru",
  182.     "source" : "direct"
  183.   }
  184. }
  185. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  186. {
  187.  "filter": {
  188.    "term": {
  189.      "email": "test@test.ru"
  190.    }
  191.  }
  192. }'
  193. {
  194.   "took" : 39,
  195.   "timed_out" : false,
  196.   "_shards" : {
  197.     "total" : 5,
  198.     "successful" : 5,
  199.     "failed" : 0
  200.   },
  201.   "hits" : {
  202.     "total" : 0,
  203.     "max_score" : null,
  204.     "hits" : [ ]
  205.   }
  206. }
  207. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  208. quote> {
  209. quote>   "_source": [
  210. quote>     "type",
  211. quote>     "email"
  212. quote>   ],
  213. quote>   "filter": {
  214. quote>     "term": {
  215. quote>       "email": "test@test.ru"
  216. quote>     }
  217. quote>   }
  218. quote> }'
  219. {
  220.   "took" : 35,
  221.   "timed_out" : false,
  222.   "_shards" : {
  223.     "total" : 5,
  224.     "successful" : 5,
  225.     "failed" : 0
  226.   },
  227.   "hits" : {
  228.     "total" : 0,
  229.     "max_score" : null,
  230.     "hits" : [ ]
  231.   }
  232. }
  233. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  234. quote> {
  235. quote>   "query": {
  236. quote>     "term": {
  237. quote>       "email": "test@test.ru"
  238. quote>     }
  239. quote>   }
  240. quote> }'
  241. {
  242.   "took" : 247,
  243.   "timed_out" : false,
  244.   "_shards" : {
  245.     "total" : 5,
  246.     "successful" : 5,
  247.     "failed" : 0
  248.   },
  249.   "hits" : {
  250.     "total" : 0,
  251.     "max_score" : null,
  252.     "hits" : [ ]
  253.   }
  254. }
  255. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/3?pretty
  256. dquote> ]
  257. dquote>
  258. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/3?pretty
  259. dquote> "
  260. curl: (3) Illegal characters found in URL
  261. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/3?pretty"
  262. {
  263.  "_index" : "releadgion",
  264.  "_type" : "user_action",
  265.  "_id" : "3",
  266.  "_version" : 1,
  267.  "found" : true,
  268.  "_source" : {
  269.    "type" : "advert_stopped",
  270.    "attributes" : {
  271.      "email" : "test@test.ru",
  272.      "campaign_id" : 12,
  273.      "advert_id" : 44
  274.    }
  275.  }
  276. }
  277. ➜  ~ curl -XPUT "http://localhost:9200/releadgion/user_action/1?pretty" -d'{ "type": "registration", "email": "test@test.ru", "source": "direct" }'
  278. {
  279.  "_index" : "releadgion",
  280.  "_type" : "user_action",
  281.  "_id" : "1",
  282.  "_version" : 4,
  283.  "_shards" : {
  284.    "total" : 2,
  285.    "successful" : 1,
  286.    "failed" : 0
  287.  },
  288.  "created" : false
  289. }
  290. ➜  ~ curl -XPUT "http://localhost:9200/releadgion/user_action/2?pretty" -d'{ "type": "campaign_created", "email": "test@test.ru", "campaign_id": 12, "platform": "my_target" }'
  291. {
  292.  "_index" : "releadgion",
  293.  "_type" : "user_action",
  294.  "_id" : "2",
  295.  "_version" : 2,
  296.  "_shards" : {
  297.    "total" : 2,
  298.    "successful" : 1,
  299.    "failed" : 0
  300.  },
  301.  "created" : false
  302. }
  303. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/2?pretty"
  304. {
  305.  "_index" : "releadgion",
  306.  "_type" : "user_action",
  307.  "_id" : "2",
  308.  "_version" : 2,
  309.  "found" : true,
  310.  "_source" : {
  311.    "type" : "campaign_created",
  312.    "email" : "test@test.ru",
  313.    "campaign_id" : 12,
  314.    "platform" : "my_target"
  315.  }
  316. }
  317. ➜  ~ curl -XPUT "http://localhost:9200/releadgion/user_action/3?pretty" -d'{ "type": "advert_stopped", "email": "test@test.ru", "campaign_id": 12, "advert_id": 44 }'
  318. {
  319.  "_index" : "releadgion",
  320.  "_type" : "user_action",
  321.  "_id" : "3",
  322.  "_version" : 2,
  323.  "_shards" : {
  324.    "total" : 2,
  325.    "successful" : 1,
  326.    "failed" : 0
  327.  },
  328.  "created" : false
  329. }
  330. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  331. {
  332.  "query": {
  333.    "term": {
  334.      "email": "test@test.ru"
  335.    }
  336.  }
  337. }'
  338. {
  339.  "took" : 7,
  340.  "timed_out" : false,
  341.  "_shards" : {
  342.    "total" : 5,
  343.    "successful" : 5,
  344.    "failed" : 0
  345.  },
  346.  "hits" : {
  347.    "total" : 0,
  348.    "max_score" : null,
  349.    "hits" : [ ]
  350.  }
  351. }
  352. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  353. {
  354.  "filter": {
  355.    "term": {
  356.      "email": "test@test.ru"
  357.    }
  358.  }
  359. }'
  360. {
  361.  "took" : 3,
  362.  "timed_out" : false,
  363.  "_shards" : {
  364.    "total" : 5,
  365.    "successful" : 5,
  366.    "failed" : 0
  367.  },
  368.  "hits" : {
  369.    "total" : 0,
  370.    "max_score" : null,
  371.    "hits" : [ ]
  372.  }
  373. }
  374. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  375. quote> {
  376. quote>   "filter": {
  377. quote>     "term": {
  378. quote>       "email": "test@test.ru"
  379. quote>     }
  380. quote>   }
  381. quote> }'
  382. {
  383.  "took" : 26,
  384.  "timed_out" : false,
  385.  "_shards" : {
  386.    "total" : 5,
  387.    "successful" : 5,
  388.    "failed" : 0
  389.  },
  390.  "hits" : {
  391.    "total" : 0,
  392.    "max_score" : null,
  393.    "hits" : [ ]
  394.  }
  395. }
  396. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  397. quote> {
  398. quote>   "query": {
  399. quote>     "bool": {
  400. quote>       "filter": [
  401. quote>         { "term": { "email": "test@test.ru" } }
  402. quote>       ]
  403. quote>     }
  404. quote>   }
  405. quote> }'
  406. {
  407.  "took" : 38,
  408.  "timed_out" : false,
  409.  "_shards" : {
  410.    "total" : 5,
  411.    "successful" : 5,
  412.    "failed" : 0
  413.  },
  414.  "hits" : {
  415.    "total" : 0,
  416.    "max_score" : null,
  417.    "hits" : [ ]
  418.  }
  419. }
  420. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  421. quote> {
  422. quote> "_source": [
  423. quote>     "type",
  424. quote>     "email"
  425. quote>   ],
  426. quote>   "filter": {
  427. quote>     "term": {
  428. quote>       "email": "test@test.ru"
  429. quote>     }
  430. quote>   }
  431. quote> }'
  432. {
  433.  "took" : 21,
  434.  "timed_out" : false,
  435.  "_shards" : {
  436.    "total" : 5,
  437.    "successful" : 5,
  438.    "failed" : 0
  439.  },
  440.  "hits" : {
  441.    "total" : 0,
  442.    "max_score" : null,
  443.    "hits" : [ ]
  444.  }
  445. }
  446. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  447. quote> {
  448. quote> "_source": [
  449. quote>     "type",
  450. quote>     "email"
  451. quote>   ],
  452. quote>   "filter": {
  453. quote>     "term": {
  454. quote>       "type": "registration"
  455. quote>     }
  456. quote>   }
  457. quote> }'
  458. {
  459.  "took" : 132,
  460.  "timed_out" : false,
  461.  "_shards" : {
  462.    "total" : 5,
  463.    "successful" : 5,
  464.    "failed" : 0
  465.  },
  466.  "hits" : {
  467.    "total" : 1,
  468.    "max_score" : 1.0,
  469.    "hits" : [ {
  470.      "_index" : "releadgion",
  471.      "_type" : "user_action",
  472.      "_id" : "1",
  473.      "_score" : 1.0,
  474.      "_source" : {
  475.        "type" : "registration",
  476.        "email" : "test@test.ru"
  477.      }
  478.    } ]
  479.  }
  480. }
  481. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  482. quote> {
  483. quote> "_source": [
  484. quote>     "type",
  485. quote>     "email"
  486. quote>   ],
  487. quote>   "filter": {
  488. quote>     "term": {
  489. quote>       "email": "test@test.ru"
  490. quote>     }
  491. quote>   }
  492. quote> }'
  493. {
  494.  "took" : 7,
  495.  "timed_out" : false,
  496.  "_shards" : {
  497.    "total" : 5,
  498.    "successful" : 5,
  499.    "failed" : 0
  500.  },
  501.  "hits" : {
  502.    "total" : 0,
  503.    "max_score" : null,
  504.    "hits" : [ ]
  505.  }
  506. }
  507. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty" -d'
  508. quote> {
  509. quote>   "filter": {
  510. quote>     "term": {
  511. quote>       "type": "registration"
  512. quote>     }
  513. quote>   }
  514. quote> }'
  515. {
  516.  "took" : 26,
  517.  "timed_out" : false,
  518.  "_shards" : {
  519.    "total" : 5,
  520.    "successful" : 5,
  521.    "failed" : 0
  522.  },
  523.  "hits" : {
  524.    "total" : 1,
  525.    "max_score" : 1.0,
  526.    "hits" : [ {
  527.      "_index" : "releadgion",
  528.      "_type" : "user_action",
  529.      "_id" : "1",
  530.      "_score" : 1.0,
  531.      "_source" : {
  532.        "type" : "registration",
  533.        "email" : "test@test.ru",
  534.        "source" : "direct"
  535.      }
  536.    } ]
  537.  }
  538. }
  539. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty&hits" -d'
  540. {
  541.  "filter": {
  542.    "term": {
  543.      "type": "registration"
  544.    }
  545.  }
  546. }'
  547. {
  548.  "took" : 15,
  549.  "timed_out" : false,
  550.  "_shards" : {
  551.    "total" : 5,
  552.    "successful" : 5,
  553.    "failed" : 0
  554.  },
  555.  "hits" : {
  556.    "total" : 1,
  557.    "max_score" : 1.0,
  558.    "hits" : [ {
  559.      "_index" : "releadgion",
  560.      "_type" : "user_action",
  561.      "_id" : "1",
  562.      "_score" : 1.0,
  563.      "_source" : {
  564.        "type" : "registration",
  565.        "email" : "test@test.ru",
  566.        "source" : "direct"
  567.      }
  568.    } ]
  569.  }
  570. }
  571. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty&_source" -d'
  572. {
  573.  "filter": {
  574.    "term": {
  575.      "type": "registration"
  576.    }
  577.  }
  578. }'
  579. {
  580.  "took" : 14,
  581.  "timed_out" : false,
  582.  "_shards" : {
  583.    "total" : 5,
  584.    "successful" : 5,
  585.    "failed" : 0
  586.  },
  587.  "hits" : {
  588.    "total" : 1,
  589.    "max_score" : 1.0,
  590.    "hits" : [ {
  591.      "_index" : "releadgion",
  592.      "_type" : "user_action",
  593.      "_id" : "1",
  594.      "_score" : 1.0,
  595.      "_source" : {
  596.        "type" : "registration",
  597.        "email" : "test@test.ru",
  598.        "source" : "direct"
  599.      }
  600.    } ]
  601.  }
  602. }
  603. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty&_source" -d'
  604. {
  605.  "filter": {
  606.    "term": {
  607.      "email": "test@test.ru"
  608.    }
  609.  }
  610. }'
  611. {
  612.  "took" : 7,
  613.  "timed_out" : false,
  614.  "_shards" : {
  615.    "total" : 5,
  616.    "successful" : 5,
  617.    "failed" : 0
  618.  },
  619.  "hits" : {
  620.    "total" : 0,
  621.    "max_score" : null,
  622.    "hits" : [ ]
  623.  }
  624. }
  625. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty&_source" -d'
  626. {
  627.  "filter": {
  628.    "term": {
  629.      "source": "direct"
  630.    }
  631.  }
  632. }'
  633. {
  634.  "took" : 27,
  635.  "timed_out" : false,
  636.  "_shards" : {
  637.    "total" : 5,
  638.    "successful" : 5,
  639.    "failed" : 0
  640.  },
  641.  "hits" : {
  642.    "total" : 1,
  643.    "max_score" : 1.0,
  644.    "hits" : [ {
  645.      "_index" : "releadgion",
  646.      "_type" : "user_action",
  647.      "_id" : "1",
  648.      "_score" : 1.0,
  649.      "_source" : {
  650.        "type" : "registration",
  651.        "email" : "test@test.ru",
  652.        "source" : "direct"
  653.      }
  654.    } ]
  655.  }
  656. }
  657. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty&_source" -d'
  658. {
  659.  "filter": {
  660.    "term": {
  661.      "email": "test"
  662.    }
  663.  }
  664. }'
  665. {
  666.  "took" : 7,
  667.  "timed_out" : false,
  668.  "_shards" : {
  669.    "total" : 5,
  670.    "successful" : 5,
  671.    "failed" : 0
  672.  },
  673.  "hits" : {
  674.    "total" : 3,
  675.    "max_score" : 1.0,
  676.    "hits" : [ {
  677.      "_index" : "releadgion",
  678.      "_type" : "user_action",
  679.      "_id" : "2",
  680.      "_score" : 1.0,
  681.      "_source" : {
  682.        "type" : "campaign_created",
  683.        "email" : "test@test.ru",
  684.        "campaign_id" : 12,
  685.        "platform" : "my_target"
  686.      }
  687.    }, {
  688.      "_index" : "releadgion",
  689.      "_type" : "user_action",
  690.      "_id" : "1",
  691.      "_score" : 1.0,
  692.      "_source" : {
  693.        "type" : "registration",
  694.        "email" : "test@test.ru",
  695.        "source" : "direct"
  696.      }
  697.    }, {
  698.      "_index" : "releadgion",
  699.      "_type" : "user_action",
  700.      "_id" : "3",
  701.      "_score" : 1.0,
  702.      "_source" : {
  703.        "type" : "advert_stopped",
  704.        "email" : "test@test.ru",
  705.        "campaign_id" : 12,
  706.        "advert_id" : 44
  707.      }
  708.    } ]
  709.  }
  710. }
  711. ➜  ~ curl -XGET "http://localhost:9200/releadgion/user_action/_search?pretty&_source" -d'
  712. {
  713.  "filter": {
  714.    "term": {
  715.      "email": "test"
  716.    }
  717.  }
  718. }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement