Skip to content

Instantly share code, notes, and snippets.

@animesh-agarwal
Created August 23, 2018 18:01
Show Gist options
  • Save animesh-agarwal/dbf4f8e2b53171a3febdbedbdbb61ddb to your computer and use it in GitHub Desktop.
Save animesh-agarwal/dbf4f8e2b53171a3febdbedbdbb61ddb to your computer and use it in GitHub Desktop.
{
"variables": [],
"info": {
"name": "Elastic Search Requests",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Adding documents to index",
"request": {
"url": "http://localhost:9200/movies/movie/",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{ \r\n \"name\":\"Christopher Robin\",\r\n \"genre\":\"Comedy\",\r\n \"summary\":\"A working-class family man, Christopher Robin, encounters his childhood friend Winnie-the-Pooh, who helps him to rediscover the joys of life\",\r\n \"yearofrelease\":2018,\r\n \"metascore\":60,\r\n \"votes\":9648,\r\n \"rating\":7.9\r\n}"
},
"description": ""
},
"response": []
},
{
"name": "Searching ",
"request": {
"url": {
"raw": "http://localhost:9200/movies/_search?q=Action",
"protocol": "http",
"host": [
"localhost"
],
"port": "9200",
"path": [
"movies",
"_search"
],
"query": [
{
"key": "q",
"value": "Action",
"equals": true,
"description": ""
}
],
"variable": []
},
"method": "GET",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "Get the mappings of an index",
"request": {
"url": "http://localhost:9200/movies/_mappings",
"method": "GET",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "Creating index with custom settings and mappings",
"request": {
"url": "http://localhost:9200/newmovies1",
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"settings\":{\r\n \"analysis\":{\r\n \"filter\":{\r\n \"stemmer\":{\r\n \"type\":\"stemmer\",\r\n \"language\":\"english\"\r\n },\r\n \"stopwords\":{\r\n \"type\":\"stop\",\r\n \"stopwords\":[\r\n \"_english_\"\r\n ]\r\n }\r\n },\r\n \"analyzer\":{\r\n \"custom_analyzer\":{\r\n \"filter\":[\r\n \"stopwords\",\r\n \"lowercase\",\r\n \"stemmer\"\r\n ],\r\n \"type\":\"custom\",\r\n \"tokenizer\":\"standard\"\r\n }\r\n }\r\n }\r\n },\r\n \"mappings\":{\r\n \"movie\":{\r\n \"properties\":{\r\n \"genre\":{\r\n \"type\":\"keyword\"\r\n },\r\n \"metascore\":{\r\n \"type\":\"long\"\r\n },\r\n \"name\":{\r\n \"type\":\"text\",\r\n \"analyzer\":\"custom_analyzer\",\r\n \"search_analyzer\":\"custom_analyzer\"\r\n },\r\n \"rating\":{\r\n \"type\":\"float\"\r\n },\r\n \"summary\":{\r\n \"type\":\"text\",\r\n \"analyzer\":\"custom_analyzer\",\r\n \"search_analyzer\":\"custom_analyzer\"\r\n },\r\n \"votes\":{\r\n \"type\":\"long\"\r\n },\r\n \"yearofrelease\":{\r\n \"type\":\"long\"\r\n }\r\n }\r\n }\r\n }\r\n}"
},
"description": ""
},
"response": []
},
{
"name": "Analyze API",
"request": {
"url": "http://localhost:9200/newmovies1/_analyze",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{ \n \"analyzer\":\"custom_analyzer\",\n \"text\":\"How to create a contact\"\n}"
},
"description": ""
},
"response": []
},
{
"name": "Get all indices",
"request": {
"url": "http://localhost:9200/_cat/indices?",
"method": "GET",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "Get the settings of an index",
"request": {
"url": "http://localhost:9200/newmovies/_settings",
"method": "GET",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "Creating an document with specific id",
"request": {
"url": "http://localhost:9200/movies/movie/1",
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{ \r\n \"name\":\"Black Panther\",\r\n \"genre\":\"Action\",\r\n \"summary\":\"T'Challa, heir to the hidden but advanced kingdom of Wakanda, must step forward to lead his people into a new future and must confront a challenger from his country's past\",\r\n \"yearofrelease\":2018,\r\n \"metascore\":88,\r\n \"votes\":32766,\r\n \"rating\":7.4\r\n}"
},
"description": ""
},
"response": []
},
{
"name": "Delete a specific record",
"request": {
"url": "http://localhost:9200/movies/movie/1",
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{ \r\n \"name\":\"Black Panther\",\r\n \"genre\":\"Action\",\r\n \"summary\":\"T'Challa, heir to the hidden but advanced kingdom of Wakanda, must step forward to lead his people into a new future and must confront a challenger from his country's past\",\r\n \"yearofrelease\":2018,\r\n \"metascore\":88,\r\n \"votes\":32766,\r\n \"rating\":7.4\r\n}"
},
"description": ""
},
"response": []
},
{
"name": "Reindex",
"request": {
"url": "http://localhost:9200/_reindex",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"source\": {\r\n \"index\": \"movies\"\r\n },\r\n \"dest\": {\r\n \"index\": \"newmovies\"\r\n }\r\n}"
},
"description": ""
},
"response": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment