Hi,
I am unable to create index on one particular node present in nested document.Following is the json I have in my database
{
"pins": [
{
"pin_id": "46049",
"pin_type": "report",
"place_id": "0",
"place_name": "Reported Near War Memorial Arch",
"pin_story_title": null,
"pin_story": "Just a test report",
"pin_rate": 0,
"pin_privacy": 1,
"pin_create_date": "2017-11-27 10:35:23",
"place_lat": 28.61279604,
"place_long": 77.22921111,
"status": 1,
"point": 0,
"social_id": "native",
"progress": 0,
"cat_name": "Map Issues",
"child_cat_name": "Incorrect Name",
"cat_id": 1,
"child_cat_id": 6,
"modified_by": null,
"expiry_date": 1827291923,
"user_name": "mustanish123",
"name": "Altamash",
"photo": "mustanish12359d75cfc8aa3b.jpg",
"action": {
"flagCount": 0,
"likeCount": 0,
"commentCount": 0
},
"images": [],
"identifier": "0027459f3fa673bb58fa3ca397d44376"
},
{
"pin_id": "45851",
"pin_type": "report",
"place_id": "FS2SE3",
"place_name": "Giridih, Jharkhand",
"pin_story_title": null,
"pin_story": "Can't find places of this town on map",
"pin_rate": 0,
"pin_privacy": 1,
"pin_create_date": "2017-11-25 15:01:44",
"place_lat": 24.191601,
"place_long": 86.29272,
"status": 1,
"point": 0,
"social_id": "native",
"progress": 0,
"cat_name": "Map Issues",
"child_cat_name": "Place Missing",
"cat_id": 1,
"child_cat_id": 7,
"modified_by": null,
"expiry_date": 1827135104,
"user_name": "mustanish123",
"name": "Altamash",
"photo": "mustanish12359d75cfc8aa3b.jpg",
"action": {
"flagCount": 0,
"likeCount": 0,
"commentCount": 0
},
"images": [],
"identifier": "00e7f016eea59eaeeb9969e6cca930de"
},
]}
I can create index on place_lat node, pin_type but I am not able to create index on place_id.I am using following query to create index on place_id
CREATE INDEX activity_pin_place_id
ON activity
((distinct (array (pin
.place_id
) for pin
in pins
end)));
I had to flush entire bucket to create index on place_id but after creating index on place_id, I get this error
[
{
"code": 5000,
"msg": "dial tcp 127.0.0.1:9101: getsockopt: connection refused from 127.0.0.1:9101 - cause: dial tcp 127.0.0.1:9101: getsockopt: connection refused from 127.0.0.1:9101",
"query_from_user": "SELECT `pin` FROM `activity` USE INDEX (`activity_pin_place_id` USING GSI) UNNEST `activity`.`pins` AS `pin` WHERE `pin`.`pin_type`=\"report\" AND `pin`.`place_id`='MMI000' AND `pin`.`status`=1 AND `pin`.`user_name`!='mustanish123' \nUNION ALL \nSELECT `pin` FROM `activity` USE INDEX (`activity_pin_place_id` USING GSI) UNNEST `activity`.`pins` AS `pin` WHERE `pin`.`pin_type`=\"report\" AND `pin`.`place_id`='MMI000' AND `pin`.`user_name`='mustanish123' ORDER BY `pin`.`user_name`='mustanish123' DESC"
},
{
"code": 5000,
"msg": "dial tcp 127.0.0.1:9101: getsockopt: connection refused from 127.0.0.1:9101 - cause: dial tcp 127.0.0.1:9101: getsockopt: connection refused from 127.0.0.1:9101"
}
]
I get this error on query failure and when query is successfully executed I get result but most query fails.On dropping Index everything is back to normal, but dropping index makes my query slow