Synopsys




GET _search
{
 "query": {
 "match_all": {}
 }
}

POST /_aliases
{
 "actions": [
 {
 "add": {
 "index": "myindex",
 "alias": "alias1"
 }
 }
 ]
}

DELETE /test1

PUT /test1
{
 "mappings": {
 "type1": {
 "properties": {
 "user": {
 "type": "keyword"
 }
 }
 }
 }
}

POST /test1/type1
{
 "user": "Amar Sharma1",
 "age": 45,
 "experience": 10
}


POST /test1/type1
{
 "user": "Amar Sharma2",
 "age": 45,
 "experience": 10
}

POST /test1/type1
{
 "user": "Amar Sharma3",
 "age": 45,
 "experience": 10
}

POST /test1/type1
{
 "user": "kimchy",
 "age": 45,
 "experience": 10
}

POST /_aliases
{
 "actions": [
 {
 "add": {
 "index": "test1",
 "alias": "alias2",
 "filter": {
 "term": {
 "user": "kimchy"
 }
 }
 }
 }
 ]
}

GET /alias2/_search

PUT /test1/type1/1?routing=user1&refresh=true&pretty
{
 "user": "Srinivas"
}

PUT /test1/type1/1?routing=user1&refresh=true&pretty
{
 "user": "Srinivas"
}

GET /test1/type1/1

GET /test1/type1/1?routing=amar

GET /test1/type1/1?routing=user1


PUT /company1
{
 "mappings": {
 "employee": {
 "properties": {
 "age": {
 "type": "long"
 },
 "experience": {
 "type": "long"
 },
 "name": {
 "type": "string",
 "analyzer": "standard"
 }
 }
 }
 }
}

GET company1/employee/_mapping

GET company/_search

GET company1/_search

DELETE company

PUT /company
{
 "mappings": {
 "employee": {
 "properties": {
 "age": {
 "type": "long"
 },
 "experience": {
 "type": "long"
 },
 "name": {
 "type": "string",
 "analyzer": "standard"
 }
 }
 }
 }
}
 
POST /company/employee
{
 "name": "Amar Sharma",
 "age": 45,
 "experience": 10
}

POST /company/employee
{
 "name": "Sriknaht Kandi",
 "age" : 35,
 "experience" : 7
 }

POST /company/employee
{
 "name": "Abdul Malik",
 "age" : 25,
 "experience" : 3,
 }

PUT /company/employee/2
{
 "name": "Amar3 Sharma",
 "age" : 45,
 "experience" : 10
 }
GET /company/employee/2


PUT /company/employee/2
{
 "name": "Amar3 Sharma",
 "age" : 45
 }

PUT /company/employee/2
{
 "name": "Anant Sharma",
 "age" : 45,
 "FatherName": "Amar Sharma"
 }
PUT /company/employee/3
{
 "name": "Anant Sharma1",
 "age" : 45,
 "FatherName": "Amar Sharma"
 }
 
PUT /company/employee/4
{
 "name": "Amar5 Sharma",
 "age" : 45,
 "FatherName": "Suresh Chandra"
 }
 
PUT /company1/employee/6
{
 "name": "Amar6 Sharma6",
 "age" : 45,
 "FatherName": "Suresh Chandra"
 }
 
 
POST /company/employee/2/_update
{
"script": "ctx._source.age+=1", 
"retry_on_conflict": 3
}

GET /company/employee/_search?pretty

GET /company/employee/_search?pretty=true
{ 
 "query": {
 "query_string": {
 "query": "Amar"
 }
 }
}

GET /_search?pretty
{
 "query": {
 "match": {
 "name": "Amar Sharma"
 }
 }
 }

GET /company/employee/_search?pretty=true
{ 
 "query": {
 "query_string": {
 "query": "Amar*"
 }
 }
}
 
GET /test-data/cities/_search?pretty=true
{
 "query": {
 "filtered": {
 "filter": {
 "term": {
 "name": "Amar"
 }
 }
 }
 }
}

GET /company/employee/_search?pretty
{
 "query": {
 "range": {
 "age": {
 "from": 15,
 "to": 50
 }
 }
 }
}
 
GET /company/employee/_search?pretty
{
 "query": {
 "range": {
 "age": {
 "from": 26,
 "to": 50
 }
 }
 }
}


GET /company/employee/_search?pretty
{
 "query": {
 "bool": {
 "should": [
 {
 "match": {
 "name": "kandi1"
 }
 },
 {
 "match": {
 "name": "Anant Sharma"
 }
 }
 ],
 "must": {
 "range": {
 "age": {
 "from": 45,
 "to": 55
 }
 }
 },
 "minimum_should_match": 1
 }
 }
}


GET /_search?pretty
{
 "query": {
 "bool": {
 "must": {
 "match": {
 "name": "Anant"
 }
 },
 "should": {
 "range": {
 "age": {
 "gte": 46
 }
 }
 }
 }
 }
}


GET /index/_search 
GET /index1,index2/_search 
GET /company*/_search 
GET /index/type/_search 
GET /index/type1,type2/_search 
GET /index/type*/_search 
GET /_all/type*/_search


GET /company/_search?size=5&from=0 
GET /company/_search?size=5&from=5 
GET /company/_search?size=5&from=10

GET /_search?q=name:Sharma
GET /_search?q=name:Amar5
GET /_search?q=name:Amar

POST /company/employee
{
 "name": "Abdul2 Malik2",
 "age": 25,
 "experience": 3,
 "date": "2013-04-01"
}
POST /company/employee
{
 "name": "Abdul3 Malik3",
 "age": 25,
 "experience": 3,
 "date": "2013-03-01"
}

POST /company/employee
{
 "name": "Abdul4 Malik4",
 "age": 25,
 "experience": 3,
 "date": "2013-02-01"
}

GET /_search?q=+date:>2013-03-01+name:Amar

POST /company/employee
{
 "name": "Abdul4 Malik4",
 "age": 25,
 "experience": 3,
 "date": "2013-02-01",
 "FatherName" : "@Amar"
}

######## are same #######
GET /_search?q=_all:Amar
GET /_search?q=Amar

############################

POST /company/employee
{
 "name": "Abdul7 Malik7",
 "username": "abdul2013",
 "age": 25,
 "experience": 3,
 "date": "2014-02-01",
 "FatherName" : "@Amar"
}

POST /company/employee
{
 "name": "Abdul7 Malik7",
 "username": "abdul2013",
 "age": 25,
 "experience": 3,
 "date": "2014-02-01",
 "FatherName" : "@Amar"
}

POST /company/employee
{
 "name": "Abdul8 Malik8",
 "username": "abdul2013",
 "age": 25,
 "experience": 3,
 "date": "2013-02-01",
 "FatherName" : "@Amar"
}

POST /company/employee
{
 "name": "Abdul9 Malik9",
 "username": "abdul 2013",
 "age": 25,
 "experience": 3,
 "date": "2014-02-01",
 "FatherName" : "@Amar"
}

GET company/_mapping

GET company/_search?q=2013

GET company/_search?q=date:2013

POST /company/employee
{
 "name": "Andrew Thomas",
 "username": "Abdul9 Malik9",
 "age": 25,
 "experience": 3,
 "date": "2014-02-01",
 "FatherName" : "David Knol"
}

GET /_search?pretty
{
 "query": {
 "bool": {
 "must": {
 "match": {
 "name": "Andrew Gabbar"
 }
 },
 "should": {
 "range": {
 "age": {
 "gte": 15
 }
 }
 }
 }
 }
}

GET /_search?pretty=true
{
 
"query": { 
 "match": { 
 "name": { 
 "query": "Anant Sharma", 
 "operator": "or" 
 } 
 } 
}
}

POST _search
{
 "query": {
 "term" : { "username" : "abdul 2013" } 
 }
}

GET company/_search?pretty=true
{ 
 "query": { 
 "bool": { 
 "should": [ 
 { "term": { "username": "Amar" }}, 
 { "term": { "username": "abdul2013"}} 
 ] 
 }
 } 
}


PUT /myapp
{
 "mapping": {
 "tweet": {
 "properties": {
 "tweet": {
 "type": "string"
 },
 "name": {
 "type": "string"
 },
 "nick": {
 "type": "string"
 },
 "Date": {
 "type": "date", "format": "yyyy-MM-dd HH:mm:ss"
 },
 "rt": {
 "type": "long"
 }
 }
 }
 }
}

POST _analyze
{
 "analyzer": "whitespace",
 "text": "The quick brown fox."
}

POST _analyze
{
 "tokenizer": "standard",
 "filter": [ "lowercase", "asciifolding" ],
 "text": "Is this déja vu? A quick fox jump over lazy pumped"
}

POST _analyze
{
 "tokenizer": "standard",
 "filter": [ "lowercase", "asciifolding","stemmer" ],
 "text": "Is this déja vu? A quick fox jumped over lazy dog"
}

POST _analyze
{
 "tokenizer": "standard",
 "filter": [ "synonym", "asciifolding" ],
 "text": "Is this déja vu?"
}
POST _analyze
{
 "analyzer": "simple",
 "text": "The 5 quic4k brown fox."
}

POST _analyze
{
 "analyzer": "simple",
 "text": "Time2School."
}