curl examples plus elasticsearch mapping examples. Also note that we can use sense - a JSON aware elasticsearch interface which generated these curl commands and executed them
curl -XGET "http://localhost:9200/bibdata/bibdata/_search " -d'
{
"query": {
"match": {
"series": "that"
}
}
}'
curl -XPUT "http://localhost:9200/bibdatahp" -d'
{
"mappings": {
"bibdatatype": {
"transform": {
"script": "ctx._source[\"isbndisplaytgt\"] = ctx._source[\"isbn10\"] + \" \" + ctx._source[\"isbn13\"]",
"lang": "groovy"
},
"properties": {
"id": {
"type": "string"
},
"isbn": {
"type": "string",
"copy_to": "isbntgt"
},
"isbn10": {
"type": "string",
"copy_to": "isbntgt"
},
"isbn13": {
"type": "string",
"copy_to": "isbntgt"
},
"isbntgt": {
"type": "string",
"store": true
},
"isbndisplaytgt": {
"type": "string",
"store": true
},
"issn": {
"type": "string"
},
"otherIdentifier": {
"type": "string"
}
}
}
}
}'
curl -Xget "http://localhost:9200/ingest/pipeline/isbnTransform"
PUT _ingest/pipeline/isbnTransform
{
"description": "Merge ISBN10 and ISBN13",
"processors": [
{
"set": {
"field": "isbndisplaytgt",
"value": "{{isbn10}} + ' ' + {{isbn13}}"
}
}
]
}
PUT _ingest/pipeline/rename_hostname
{
"processors": [
{
"set": {
"field": "isbndisplaytgt"
"value": "{{isbn10}} {{isbn13}}"
}
}
]
}
POST bibdatahp/bibdatatype/
{"index":{"_id":1571366}}
{"isbn": "9781847152404", "isbn10": "1847154" , "isbn13": "9781847152404"}
curl -XPOST "http://localhost:9200/bibdatahp/bibdatatype/?pipeline=isbnTransform" -d'
{"index":{"_id":1571366}}
{"isbn": "9781847152404", "isbn10": "1847154" , "isbn13": "9781847152404"}
'
POST _ingest/pipeline/isbnTransform/_simulate
{
"docs": [
{
"_source": {
"isbn": "9781847152404",
"isbn10": "1847154",
"isbn13": "9781847152404"
}
}
]
}
curl -XPUT "http://localhost:9200/bibdatahp" -d'
{
"mappings": {
"bibdatatype": {
"set": {
"field": "isbndisplaytgt"
"value": "{{isbn10}} {{isbn13}}"
},
"properties": {
"id": {
"type": "string"
},
"isbn": {
"type": "string",
"copy_to": "isbntgt"
},
"isbn10": {
"type": "string",
"copy_to": "isbntgt"
},
"isbn13": {
"type": "string",
"copy_to": "isbntgt"
},
"isbntgt": {
"type": "string",
"store": true
},
"isbndisplaytgt": {
"type": "string",
"store": true
},
"issn": {
"type": "string"
},
"otherIdentifier": {
"type": "string"
}
}
}
}
}'.
curl -XPUT "http://localhost:9200/bibdatahp" -d'
{
"mappings": {
"bibdatatype": {
"properties": {
"id": {
"type": "string",
"copy_to": "identifier"
},
"isbn": {
"type": "string",
"copy_to": "identifier"
},
"isbn10": {
"type": "string",
"copy_to": "identifier"
},
"isbn13": {
"type": "string",
"copy_to": "identifier"
},
"issn": {
"type": "string",
"copy_to": "identifier"
},
"otherIdentifier": {
"type": "string",
"copy_to": "identifier"
},
"Identifier": {
"type": "string"
},
"dewey": {
"type": "string"
},
"publicationDetails": {
"type": "string"
},
"publisher": {
"type": "string"
},
"placeOfPublication": {
"type": "string"
},
"dateIssued": {
"type": "string"
},
"placeOfPublicationCode": {
"type": "string"
},
"genreScis": {
"type": "string",
"copy_to": "notedAndDescription"
},
"genreMarc": {
"type": "string",
"copy_to": "notedAndDescription"
},
"notesAndDescription": {
"type": "string"
}
}
}
}
}'
-- Adding new field to existing mapping:
PUT /bibdatahp/_mapping/bibdatatype
{
"properties" : {
"testHP" : {
"type": "string"
}
}
}
curl -X POST -d @res.txt http://xx.ss.dfsdfs.182:8080/scootle-api/service/availableobjects/getlist
||resourcejson.txt had list of object ids
curl -H 'Content-Type: application/json' -X POST -d @resourcejson.txt http://10.xx.xxx.182:8080/scootle-api/service/availableobjects/getlist
|| used to enacting agent google bot for parent website so it gets ignored for reporting purpose
curl -X GET -H "User-Agent: Googlebot/2.1 (+http://www.google.com/bot.html)" -H "Cache-Control: no-cache" -H "Postman-Token: aacb2101-a36b-830e-50f9-050c896f6915" "http://192.168.75.28:8080/rest/everydayIdea/EI005_2?apiToken=a4a0ca74-9d3e-fdf0-5285-b7a209fb3726"