schema:
curl -X POST localhost:8080/alter -d '
type Customer {
id
name
email
purchase_history
}
'
Logs:
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.043551 2569588 http.go:614] Got alter request via HTTP from 127.0.0.1:22784
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.044506 2569588 server.go:377] Received ALTER op: schema:"\nid: string @index(exact) @upsert .\nname: string @index(term) .\nemail: string @index(exact) .\npurchase_history: [uid] .\n"
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.044547 2569588 server.go:1686] Got Alter request from: "127.0.0.1:22784"
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.046324 2569588 server.go:526] Got schema: &{Preds:[predicate:"0-id" value_type:STRING directive:INDEX tokenizer:"exact" upsert:true predicate:"0-name" value_type:STRING directive:INDEX tokenizer:"term" predicate:"0-email" value_type:STRING directive:INDEX tokenizer:"exact" predicate:"0-purchase_history" value_type:UID list:true ] Types:[]}
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.047724 2569588 mutation.go:202] Max open files limit: 524288
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.048770 2569588 index.go:780] Deleting indexes for 0-id
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.049084 2569588 index.go:780] Deleting indexes for 0-name
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.050666 2569588 server.go:540] ALTER op: schema:"\nid: string @index(exact) @upsert .\nname: string @index(term) .\nemail: string @index(exact) .\npurchase_history: [uid] .\n" done
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.063793 2569588 http.go:614] Got alter request via HTTP from 127.0.0.1:22786
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.064048 2569588 server.go:377] Received ALTER op: schema:"\ntype Customer {\n id\n name\n email\n purchase_history\n}\n"
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.064088 2569588 server.go:1686] Got Alter request from: "127.0.0.1:22786"
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.065496 2569588 server.go:526] Got schema: &{Preds:[] Types:[type_name:"0-Customer" fields:<predicate:"0-id" > fields:<predicate:"0-name" > fields:<predicate:"0-email" > fields:<predicate:"0-purchase_history" > ]}
Jul 02 13:14:17 stg-ashwani005 dgraph[2569560]: I0702 13:14:17.067948 2569588 server.go:540] ALTER op: schema:"\ntype Customer {\n id\n name\n email\n purchase_history\n}\n" done
Insertion of data:
curl -X POST localhost:8080/mutate -H "Content-Type: application/json" -d '{
"set": [
{
"uid": "_:customer1",
"dgraph.type": "Customer",
"id": "1",
"name": "Alice Johnson",
"email": "alice@example.com"
},
{
"uid": "_:customer2",
"dgraph.type": "Customer",
"id": "2",
"name": "Bob Smith",
"email": "bob@example.com"
}
]
}'
Response I get:
{"data":{"code":"Success","message":"Done","queries":null,"uids":{"dg.960315563.1":"0x2720","dg.960315563.2":"0x2723","purchase1":"0x2721","purchase2":"0x2722","purchase3":"0x2724","purchase4":"0x2725"}},"extensions":{"server_latency":{"parsing_ns":191650,"processing_ns":3704405,"assign_timestamp_ns":1295739,"total_ns":5490665},"txn":{"start_ts":10348,"keys":["11h35u3v567up","1ddilwjdppv2j","1gmlrx2gms5t0","1gmlrx2gms5t1","1olx0ehdj620m","1zwvmp6gd98tv","28c6ermowwj5r","2przdhzp04s6w","2q5p2hgu1umdc","2qgxm4hdfytlh","2r56n110w1fjv","2u3bihi2lt2vy","2uaugmpvcheqj","2vlq4maf743ss","32zg2v1id4btk","33g4qzj0afh38","33g4qzj0afh3b","3k4e946smtzr8","8p8gv9lzzj9y","9726oyo3iqva","faz4bt8juuyt","faz4bt8juuyu"],"preds":["1-0-dgraph.type","1-0-id","1-0-name","2-0-email","2-0-purchase_history"]}}}
Logs
Nothing got updated in the logs
Query I used to fetch the data:
curl -H "Content-Type: application/json" -X POST localhost:8080/query -d '{
"query": "{ allCustomers(func: has(dgraph.type)) { uid dgraph.type id name email } }"
}'
Response:
{"data":{"allCustomers":[{"uid":"0x1","dgraph.type":["dgraph.graphql"]}]},"extensions":{"server_latency":{"parsing_ns":58848,"processing_ns":2382858,"encoding_ns":108988,"assign_timestamp_ns":1150921,"total_ns":3813301},"txn":{"start_ts":10360},"metrics":{"num_uids":{"_total":5,"dgraph.type":1,"email":1,"id":1,"name":1,"uid":1}}}}
Logs:
Nothing got updated in the logs
RatelUI Query:
{
allCustomers(func: has(dgraph.type)) {
uid
dgraph.type
id
name
email
}
}
Response:
{
"data": {
"allCustomers": [
{
"uid": "0x1",
"dgraph.type": [
"dgraph.graphql"
]
}
]
},
"extensions": {
"server_latency": {
"parsing_ns": 85408,
"processing_ns": 1532104,
"encoding_ns": 57038,
"assign_timestamp_ns": 1324574,
"total_ns": 3156200
},
"txn": {
"start_ts": 10378
},
"metrics": {
"num_uids": {
"_total": 5,
"dgraph.type": 1,
"email": 1,
"id": 1,
"name": 1,
"uid": 1
}
}
}
}