{"action":"created","issue":{"url":"https://api.github.com/repos/graphaware/neo4j-to-elasticsearch/issues/11","repository_url":"https://api.github.com/repos/graphaware/neo4j-to-elasticsearch","labels_url":"https://api.github.com/repos/graphaware/neo4j-to-elasticsearch/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/graphaware/neo4j-to-elasticsearch/issues/11/comments","events_url":"https://api.github.com/repos/graphaware/neo4j-to-elasticsearch/issues/11/events","html_url":"https://github.com/graphaware/neo4j-to-elasticsearch/issues/11","id":157215264,"number":11,"title":"Impossible to search by node-label or relationship-type","user":{"login":"davidrapin","id":605880,"avatar_url":"https://avatars.githubusercontent.com/u/605880?v=3","gravatar_id":"","url":"https://api.github.com/users/davidrapin","html_url":"https://github.com/davidrapin","followers_url":"https://api.github.com/users/davidrapin/followers","following_url":"https://api.github.com/users/davidrapin/following{/other_user}","gists_url":"https://api.github.com/users/davidrapin/gists{/gist_id}","starred_url":"https://api.github.com/users/davidrapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidrapin/subscriptions","organizations_url":"https://api.github.com/users/davidrapin/orgs","repos_url":"https://api.github.com/users/davidrapin/repos","events_url":"https://api.github.com/users/davidrapin/events{/privacy}","received_events_url":"https://api.github.com/users/davidrapin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/graphaware/neo4j-to-elasticsearch/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-27T14:10:13Z","updated_at":"2016-05-27T14:52:55Z","closed_at":null,"body":"Right now, the node-label/relationship-type is stored in the `_type` (not analyzed). In the future I understand that you are considering creating one ES index per node-label/relationship-type.\r\n\r\nIn both cases, it is impossible to search for nodes/relationships by node-label/relationship-type.\r\n\r\nFor example, if some of my nodes have the \"foo bar\" label, if would like to find them by searching for `\"foo\"` or `\"bar\"` or `\"foo bar\"`.\r\n```bash\r\ncurl -XPUT -d '{\"prop1\":\"abc\"}' http://localhost:9200/myindex_nodes/foo%20bar/1\r\n{\"_index\": \"myindex_nodes\", \"_type\": \"foo bar\", \"_id\": \"1\", \"_version\": 1, \"created\": true}\r\n\r\ncurl -XGET http://localhost:9200/myindex_nodes/_search?q=foo\r\n{\"hits\": {\"total\": 0}}\r\n```\r\n\r\nA solution would be to store the node-label(s)/relationship-type in a special field (`neo4j_label`), e.g.:\r\n```bash\r\ncurl -XPUT -d '{\"neo4j_labels\":[\"foo bar\"], \"prop1\":\"abc\"}' http://localhost:9200/myindex_nodes/foo%20bar/2\r\n{\"_index\":\"myindex_nodes\", \"_type\":\"foo bar\", \"_id\":\"2\", \"_version\":1, \"created\": true}\r\n\r\ncurl -XGET http://localhost:9200/myindex_nodes/_search?q=foo\r\n{\r\n  \"hits\": {\r\n    \"total\":1, \r\n    \"hits\": [\r\n      {\r\n        \"_index\": \"my_index\",\r\n        \"_type\": \"foo bar\",\r\n        \"_id\": \"2\",\r\n        \"_score\": 1.1931472,\r\n        \"_source\": {\r\n          \"neo4j_labels\": [\"foo bar\"],\r\n          \"prop1\": \"abc\"\r\n        }\r\n      }\r\n    }\r\n  ]\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/graphaware/neo4j-to-elasticsearch/issues/comments/222167446","html_url":"https://github.com/graphaware/neo4j-to-elasticsearch/issues/11#issuecomment-222167446","issue_url":"https://api.github.com/repos/graphaware/neo4j-to-elasticsearch/issues/11","id":222167446,"user":{"login":"alenegro81","id":2557275,"avatar_url":"https://avatars.githubusercontent.com/u/2557275?v=3","gravatar_id":"","url":"https://api.github.com/users/alenegro81","html_url":"https://github.com/alenegro81","followers_url":"https://api.github.com/users/alenegro81/followers","following_url":"https://api.github.com/users/alenegro81/following{/other_user}","gists_url":"https://api.github.com/users/alenegro81/gists{/gist_id}","starred_url":"https://api.github.com/users/alenegro81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alenegro81/subscriptions","organizations_url":"https://api.github.com/users/alenegro81/orgs","repos_url":"https://api.github.com/users/alenegro81/repos","events_url":"https://api.github.com/users/alenegro81/events{/privacy}","received_events_url":"https://api.github.com/users/alenegro81/received_events","type":"User","site_admin":false},"created_at":"2016-05-27T14:52:55Z","updated_at":"2016-05-27T14:52:55Z","body":"this is a good catch. "}}
{"actor":{"display_login":"alenegro81"}}