blob: 5b1242a6100b6eb6654c97cf0a8e702735db6429 [file] [log] [blame]
(window.webpackJsonp=window.webpackJsonp||[]).push([[38],{"./src/documents/Search/SearchRelationship.md":function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return p}));var i=a("../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),n=(a("../node_modules/react/index.js"),a("../node_modules/@mdx-js/react/dist/esm.js")),s=(a("./theme/styles/styled-colors.js"),a("../node_modules/react-syntax-highlighter/dist/esm/styles/hljs/dark.js")),r=a("../node_modules/react-syntax-highlighter/dist/esm/default-highlight.js"),o=a("./theme/components/shared/Img/index.js"),l=["components"],d={};function p(e){var t=e.components,a=Object(i.a)(e,l);return Object(n.mdx)("wrapper",Object.assign({},d,a,{components:t,mdxType:"MDXLayout"}),Object(n.mdx)("h1",{id:"relationship-search"},"Relationship Search"),Object(n.mdx)("p",null,"Apache Atlas is a metadata governance tool that features the ability to search for pre-defined entities of the defined model."),Object(n.mdx)("p",null,"We are able to search for these entities by specifying generic attributes (such as \u2018name\u2019, \u2018qualified name\u2019, \u2018description\u2019 etc), entity type definition specific attributes (attributes unique to certain entities such as \u2018cluster name\u2019 for hdfs_path type entities) and also on parameters like classifications applied, sub-types of entities and deleted entities. However these results only return entities which fulfil the parameters of the search queries."),Object(n.mdx)("p",null,"A relationship, which also follows a similar structure to an entity, describes various metadata between two entity end-points. For example, let us assume that in the case of a relationship between hive_table and hive_db, the relationship type name is called hive_table_db and it can have its own metadata which can be added as an attributes to this model."),Object(n.mdx)("p",null,"The Relationship search allows you to get the metadata between two entity model, by querying using relationship type name, and it also has support for filtering on the relationship attribute(s)."),Object(n.mdx)("p",null,"The entire query structure can be represented using the following JSON structure (called RelationshipSearchParameters)"),Object(n.mdx)(r.a,{wrapLines:!0,language:"json",style:s.a,mdxType:"SyntaxHighlighter"},'{\n "relationshipName": "hive_table_db",\n "excludeDeletedEntities": true,\n "offset": 0,\n "limit": 25,\n "relationshipFilters": { },\n "sortBy": "table_name",\n "sortOrder": ASCENDING,\n "marker": "*"\n}'),Object(n.mdx)("p",null,Object(n.mdx)("strong",{parentName:"p"},"Field description")),Object(n.mdx)(r.a,{wrapLines:!0,language:"json",style:s.a,mdxType:"SyntaxHighlighter"},"relationshipName: the type of relationship to look for\nexcludeDeletedEntities: should the search exclude deleted entities? (default: true)\noffset: starting offset of the result set (useful for pagination)\nlimit: max number of results to fetch\nrelationshipFilters: relationship attribute filter(s)\nsortBy: attribute to which results are sorted by\nsortOrder: sorting order of results\nmarker: add either offset or marker, value of marker for first page will be '*'\n and value of nextMarker: in the response will be input of marker for subsequent pages"),Object(n.mdx)("p",null,"Attribute based filtering can be done on multiple attributes with AND/OR conditions."),Object(n.mdx)("p",null,Object(n.mdx)("strong",{parentName:"p"},"Real time example of Relationship Search")),Object(n.mdx)("p",null,"Consider use-case of social media based application '",Object(n.mdx)("em",{parentName:"p"},"Instagram"),"' and its basic functionalities like:"),Object(n.mdx)("ul",null,Object(n.mdx)("li",{parentName:"ul"},Object(n.mdx)("em",{parentName:"li"},"User")," creates ",Object(n.mdx)("em",{parentName:"li"},"Posts")),Object(n.mdx)("li",{parentName:"ul"},Object(n.mdx)("em",{parentName:"li"},"User")," reacts to ",Object(n.mdx)("em",{parentName:"li"},"Posts")),Object(n.mdx)("li",{parentName:"ul"},Object(n.mdx)("em",{parentName:"li"},"User")," creates ",Object(n.mdx)("em",{parentName:"li"},"Highlight")),Object(n.mdx)("li",{parentName:"ul"},Object(n.mdx)("em",{parentName:"li"},"Posts")," added in ",Object(n.mdx)("em",{parentName:"li"},"Highlight"))),Object(n.mdx)("p",null,"Below is the Metadata Model highlighting above use-case"),Object(n.mdx)(o.a,{src:"/images/twiki/relationship_search_model.png",height:"500",width:"840",mdxType:"Img"}),Object(n.mdx)("p",null,"Example:\nConsider a user Ajay, who had uploaded his celebratory Diwali photo as a post. Users like Divya, Rahul and many others reacted with a like to his post."),Object(n.mdx)("p",null,"Now the user Ajay wants to find out the number of 'like' reactions to his post."),Object(n.mdx)("p",null,"For his search, he will focus on 'user_post' relationship type and filter those with attributes where reactions have 'like' in them and in which the post name has 'Diwali' in it."),Object(n.mdx)("p",null,Object(n.mdx)("strong",{parentName:"p"},"Example of filtering (for user_post attributes)")),Object(n.mdx)(r.a,{wrapLines:!0,language:"json",style:s.a,mdxType:"SyntaxHighlighter"},' {\n "relationshipName": "user_post",\n "excludeDeletedEntities": true,\n "offset": 0,\n "limit": 25,\n "relationshipFilters": {\n "condition": "AND",\n "criterion": [\n {\n "attributeName": "reaction",\n "operator": "eq",\n "attributeValue": "like"\n },\n {\n "attributeName": "post_name",\n "operator": "contains",\n "attributeValue": "Diwali"\n }\n ]\n }\n }'),Object(n.mdx)("p",null,Object(n.mdx)("strong",{parentName:"p"},"Supported operators for filtering")),Object(n.mdx)("p",null,"Same operators as basic search"),Object(n.mdx)("p",null,Object(n.mdx)("strong",{parentName:"p"},"CURL Samples")),Object(n.mdx)(r.a,{wrapLines:!0,language:"shell",style:s.a,mdxType:"SyntaxHighlighter"},'curl -sivk -g\n -u <user>:<password>\n -X POST\n -d \'{\n "relationshipName": "user_post",\n "excludeDeletedEntities": true,\n "offset": 0,\n "limit": 25,\n "relationshipFilters": {\n "condition": "AND",\n "criterion": [\n {\n "attributeName": "reaction",\n "operator": "eq",\n "attributeValue": "like"\n },\n {\n "attributeName": "post_name",\n "operator": "contains",\n "attributeValue": "Diwali"\n }\n ]\n }\n }\'\n <protocol>://<atlas_host>:<atlas_port>/api/atlas/v2/search/relations'))}p&&p===Object(p)&&Object.isExtensible(p)&&Object.defineProperty(p,"__filemeta",{enumerable:!0,configurable:!0,value:{name:"MDXContent",filename:"src/documents/Search/SearchRelationship.md"}}),p.isMDXComponent=!0},"./theme/components/shared/Img/index.js":function(e,t,a){"use strict";var i=a("../node_modules/react/index.js"),n=a("./docz-lib/docz/dist/index.js");t.a=e=>{const{src:t,width:a,height:s}=e,{baseUrl:r}=Object(n.useConfig)();return i.createElement("div",null,i.createElement("img",{style:{boxShadow:"0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2)",WebkitBoxShadow:"0 2px 2px 0 rgba(0,0,0,0.14) 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2)",MozBoxShadow:"0 2px 2px 0 rgba(0,0,0,0.14) 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2)"},src:`${r}${t}`,height:""+(s||"auto"),width:""+(a||"100%")}))}},"./theme/styles/styled-colors.js":function(e,t,a){"use strict";var i=a("../node_modules/react-syntax-highlighter/dist/esm/styles/hljs/dark.js");i.a.hljs.color="#37bb9b",t.a=i.a}}]);
//# sourceMappingURL=documents-search-search-relationship.b185f4c5b68d73002af0.js.map