Elasticsearch:Jira 连接器教程第一部分

90 阅读15分钟

本文由 简悦 SimpRead 转码, 原文地址 blog.csdn.net

作者:来自 Elastic Gustavo Llermaly

将我们的 Jira 内容索引到 Elaasticsearch 中以创建统一的数据源并使用文档级别安全性进行搜索。

在本文中,我们将回顾 Elastic Jira 原生连接器的一个用例。我们将使用一个模拟项目,其中一家银行正在开发一款汇款应用,需要将 Jira 中的信息集成到 Elastic 中。

原生连接器允许我们从票据、任务和其他文档中获取 Elastic 集群信息,集中数据并启用高级搜索功能。

使用此连接器的主要好处是:

  1. Jira 中的数据与 Elasticsearch 同步。
  2. 访问高级搜索功能。
  3. 文档级安全性 (DLS) 匹配源安全性。你只能搜索 Jira 中允许你查看的内容。

步骤

  1. 配置 Jira 连接器
  2. 将文档索引到 Elasticsearch
  3. 查询数据
  4. 文档级安全性 (document level security  - DLS)

配置 Jira 连接器

首先,你需要从 Jira 获取 API token 以连接到 Elasticsearch。转到此链接了解如何创建它。

将其命名为 “elastic-connector”。它应该如下所示:

获取 token 并进入 Kibana 仪表板。然后,转到原生连接器并选择 New Jira Cloud connector。

https://<YOUR_KIBANA_URL>/app/enterprise_search/content/connectors/new_connector?service_type=jira&connector_type=native

Kibana 端点替换 YOUR_KIBANA_URL。

将连接器命名为 “bank”,然后点击 “Create and attach an index named bank”,即可创建一个同名的新索引。

完成了!现在我们需要配置我们的 Jira 数据。

由于我们不会使用自己的 SSL 证书,因此我们将保持 “Enable SSL” 关闭。

你可以在官方文档中查看每个字段的详细信息。

激活文档级安全性 (DLS),以便你获得有权查看文档的用户和组。

正确配置连接器后,你可以继续同步数据,如下所示。从 Jira 获取数据可能需要几分钟。

  • 完整内容(Full Content):索引所有 Jira 文档。
  • 增量内容(Incremental Content):仅索引自上次完整内容同步以来的更改。
  • 访问控制(Access Control):在安全索引中索引 Jira 用户以激活 DLS。

我们可以检查连接器的概述来查看同步是否成功。

在 “Documents” 选项卡中,我们可以准确地看到使用连接器获取的数据。第一次同步的对象是:

  • Projects
  • Issues
  • Attachments

将文档索引到 Elasticsearch

我们不仅限于跨连接器文档进行搜索。Elasticsearch 允许你使用单个查询搜索多个索引。

在我们的示例中,我们将其他文档索引到 galactic_documents 索引中,以了解搜索如何与多个数据源配合使用:

  • GBFF 合规手册
  • Galactic Banking App 用户指南
  • 技术规格报告

但在索引之前,我们将为每个字段创建优化映射:

`

1.  PUT /galactic_documents
2.  {
3.    "mappings": {
4.      "properties": {
5.        "document_id": {
6.          "type": "keyword"
7.        },
8.        "title": {
9.          "type": "text",
10.          "fields": {
11.            "raw": {
12.              "type": "keyword"
13.            }
14.          }
15.        },
16.        "content": {
17.          "type": "text"
18.        },
19.        "release_date": {
20.          "type": "date",
21.          "format": "yyyy-MM-dd"
22.        },
23.        "page_count": {
24.          "type": "integer"
25.        },
26.        "tags": {
27.          "type": "keyword"
28.        }
29.      }
30.    }
31.  }

`![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)

配置映射后,我们现在可以索引:



1.  POST galactic_documents/_bulk
2.  { "index": { "_index": "galactic_documents", "_id": "1" } }
3.  { "document_id": "GBFF-001", "title": "Compliance Manual of the GBFF", "content": "This document sets forth the compliance standards for intergalactic financial entities: Quantum-level data encryption to guarantee security in all transactions. Mandatory multi-factor authentication for all users and administrators. Quarterly reviews of security policies and access audit logs.", "release_date": "2024-01-01", "page_count": 5, "tags": ["compliance", "security"] }
4.  { "index": { "_index": "galactic_documents", "_id": "2" } }
5.  { "document_id": "GBFF-002", "title": "User Guide for the Galactic Banking App", "content": "Welcome to the Galactic Banking application by Interstellar Finance Corp. Here you can: Transfer galactic credits to any registered account across the Milky Way. Check your balance and manage your investments in real-time. Access interplanetary loans with ease. For your security, use multi-factor authentication each time you log in.", "release_date": "2024-01-01", "page_count": 3, "tags": ["user guide", "application"] }
6.  { "index": { "_index": "galactic_documents", "_id": "3" } }
7.  { "document_id": "GBFF-003", "title": "Technical Specifications Report - Galactic Banking Project", "content": "This report details the technical architecture of the Galactic Banking application: Microservices-based backend for scalability and performance. Secure communication protocols utilizing quantum encryption. Transaction management adapted to environments with gravity variations and time dilation.", "release_date": "2024-01-01", "page_count": 7, "tags": ["technical", "specifications", "architecture"] }


查询数据

现在我们有了 Jira 对象和文档,我们可以一起搜索它们。



1.  GET bank,galactic_documents/_search
2.  {
3.    "query": {
4.      "multi_match": {
5.        "query": "galactic moon",
6.        "fields": [
7.          "content",
8.          "title",
9.          "*description",
10.          "*summary"
11.        ]
12.      }
13.    }
14.  }


查询 “galactic moon” 将为我们获取 Jira 对象和我们索引的文档:

`

1.  {
2.    "took": 3,
3.    "timed_out": false,
4.    "_shards": {
5.      "total": 3,
6.      "successful": 3,
7.      "skipped": 0,
8.      "failed": 0
9.    },
10.    "hits": {
11.      "total": {
12.        "value": 3,
13.        "relation": "eq"
14.      },
15.      "max_score": 1.2613049,
16.      "hits": [
17.        {
18.          "_index": "bank",
19.          "_id": "Marketing Mars-MM-2",
20.          "_score": 1.2613049,
21.          "_source": {
22.            "Type": "Task",
23.            "Custom_Fields": {
24.              "Satisfaction": null,
25.              "Approvals": null,
26.              "Change reason": null,
27.              "Epic Link": null,
28.              "Actual end": null,
29.              "Design": null,
30.              "Campaign assets": null,
31.              "Department": null,
32.              "Story point estimate": null,
33.              "Approver groups": null,
34.              "[CHART] Date of First Response": null,
35.              "Request Type": null,
36.              "Campaign goals": null,
37.              "Project overview key": null,
38.              "Related projects": null,
39.              "Campaign type": null,
40.              "Impact": null,
41.              "Request participants": [],
42.              "Locked forms": null,
43.              "Time to first response": null,
44.              "Work category": null,
45.              "Audience": null,
46.              "Open forms": null,
47.              "Details": null,
48.              "Sprint": null,
49.              "Stakeholders": null,
50.              "Marketing asset type": null,
51.              "Submitted forms": null,
52.              "Start date": null,
53.              "Actual start": null,
54.              "Category": null,
55.              "Change risk": null,
56.              "Target start": null,
57.              "Issue color": null,
58.              "Parent Link": {
59.                "hasEpicLinkFieldDependency": false,
60.                "showField": false,
61.                "nonEditableReason": {
62.                  "reason": "EPIC_LINK_SHOULD_BE_USED",
63.                  "message": "To set an epic as the parent, use the epic link instead"
64.                }
65.              },
66.              "Format": null,
67.              "Target end": null,
68.              "Approvers": null,
69.              "Team": null,
70.              "Change type": null,
71.              "Satisfaction date": null,
72.              "Request language": null,
73.              "Amount": null,
74.              "Rank": "0|i0003j:",
75.              "Affected services": null,
76.              "Type": null,
77.              "Time to resolution": null,
78.              "Total forms": null,
79.              "[CHART] Time in Status": null,
80.              "Organizations": [],
81.              "Flagged": null,
82.              "Project overview status": null
83.            },
84.            "Issue": {
85.              "statuscategorychangedate": "2024-11-01T17:52:30.550-0300",
86.              "issuetype": {
87.                "avatarId": 10318,
88.                "hierarchyLevel": 0,
89.                "name": "Task",
90.                "self": "https://xxxx.atlassian.net/rest/api/2/issuetype/10017",
91.                "description": "A small, distinct piece of work.",
92.                "entityId": "f30ea676-7b3d-44ad-9858-558081742a2e",
93.                "id": "10017",
94.                "iconUrl": "https://xxxx.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium",
95.                "subtask": false
96.              },
97.              "components": [],
98.              "timespent": null,
99.              "timeoriginalestimate": null,
100.              "project": {
101.                "simplified": true,
102.                "avatarUrls": {
103.                  "48x48": "https://xxxx.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10418",
104.                  "24x24": "https://xxxx.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10418?size=small",
105.                  "16x16": "https://xxxx.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10418?size=xsmall",
106.                  "32x32": "https://xxxx.atlassian.net/rest/api/2/universal_avatar/view/type/project/avatar/10418?size=medium"
107.                },
108.                "name": "Marketing Mars",
109.                "self": "https://xxxx.atlassian.net/rest/api/2/project/10003",
110.                "id": "10003",
111.                "projectTypeKey": "business",
112.                "key": "MM"
113.              },
114.              "description": null,
115.              "fixVersions": [],
116.              "aggregatetimespent": null,
117.              "resolution": null,
118.              "timetracking": {},
119.              "security": null,
120.              "aggregatetimeestimate": null,
121.              "attachment": [],
122.              "resolutiondate": null,
123.              "workratio": -1,
124.              "summary": "Conquer the moon",
125.              "issuerestriction": {
126.                "issuerestrictions": {},
127.                "shouldDisplay": true
128.              },
129.              "watches": {
130.                "self": "https://xxxx.atlassian.net/rest/api/2/issue/MM-2/watchers",
131.                "isWatching": true,
132.                "watchCount": 1
133.              },
134.              "lastViewed": "2024-11-01T17:52:34.925-0300",
135.              "creator": {
136.                "accountId": "712020:88983800-6c97-469a-9451-79c2dd3732b5",
137.                "emailAddress": "contornan_cliche.0y@icloud.com",
138.                "avatarUrls": {
139.                  "48x48": "https://secure.gravatar.com/avatar/f098101294d1a0da282bb2388df8c257?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTM-3.png",
140.                  "24x24": "https://secure.gravatar.com/avatar/f098101294d1a0da282bb2388df8c257?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTM-3.png",
141.                  "16x16": "https://secure.gravatar.com/avatar/f098101294d1a0da282bb2388df8c257?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTM-3.png",
142.                  "32x32": "https://secure.gravatar.com/avatar/f098101294d1a0da282bb2388df8c257?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTM-3.png"
143.                },
144.                "displayName": "Tomas Murua",
145.                "accountType": "atlassian",
146.                "self": "https://xxxx.atlassian.net/rest/api/2/user?accountId=712020%3A88983800-6c97-469a-9451-79c2dd3732b5",
147.                "active": true,
148.                "timeZone": "Chile/Continental"
149.              },
150.              "subtasks": [],
151.              "created": "2024-11-01T17:52:30.289-0300",
152.              "reporter": {
153.                "accountId": "712020:88983800-6c97-469a-9451-79c2dd3732b5",
154.                "emailAddress": "contornan_cliche.0y@icloud.com",
155.                "avatarUrls": {
156.                  "48x48": "https://secure.gravatar.com/avatar/f098101294d1a0da282bb2388df8c257?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTM-3.png",
157.                  "24x24": "https://secure.gravatar.com/avatar/f098101294d1a0da282bb2388df8c257?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTM-3.png",
158.                  "16x16": "https://secure.gravatar.com/avatar/f098101294d1a0da282bb2388df8c257?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTM-3.png",
159.                  "32x32": "https://secure.gravatar.com/avatar/f098101294d1a0da282bb2388df8c257?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FTM-3.png"
160.                },
161.                "displayName": "Tomas Murua",
162.                "accountType": "atlassian",
163.                "self": "https://xxxx.atlassian.net/rest/api/2/user?accountId=712020%3A88983800-6c97-469a-9451-79c2dd3732b5",
164.                "active": true,
165.                "timeZone": "Chile/Continental"
166.              },
167.              "aggregateprogress": {
168.                "total": 0,
169.                "progress": 0
170.              },
171.              "priority": {
172.                "name": "Medium",
173.                "self": "https://xxxx.atlassian.net/rest/api/2/priority/3",
174.                "iconUrl": "https://xxxx.atlassian.net/images/icons/priorities/medium.svg",
175.                "id": "3"
176.              },
177.              "labels": [],
178.              "environment": null,
179.              "timeestimate": null,
180.              "aggregatetimeoriginalestimate": null,
181.              "versions": [],
182.              "duedate": null,
183.              "progress": {
184.                "total": 0,
185.                "progress": 0
186.              },
187.              "issuelinks": [],
188.              "votes": {
189.                "hasVoted": false,
190.                "self": "https://xxxx.atlassian.net/rest/api/2/issue/MM-2/votes",
191.                "votes": 0
192.              },
193.              "comment": {
194.                "total": 0,
195.                "comments": [],
196.                "maxResults": 0,
197.                "self": "https://xxxx.atlassian.net/rest/api/2/issue/10018/comment",
198.                "startAt": 0
199.              },
200.              "assignee": null,
201.              "worklog": {
202.                "total": 0,
203.                "maxResults": 20,
204.                "startAt": 0,
205.                "worklogs": []
206.              },
207.              "updated": "2024-11-01T17:52:42.711-0300",
208.              "status": {
209.                "name": "To Do",
210.                "self": "https://xxxx.atlassian.net/rest/api/2/status/10014",
211.                "description": "",
212.                "iconUrl": "https://xxxx.atlassian.net/",
213.                "id": "10014",
214.                "statusCategory": {
215.                  "colorName": "blue-gray",
216.                  "name": "To Do",
217.                  "self": "https://xxxx.atlassian.net/rest/api/2/statuscategory/2",
218.                  "id": 2,
219.                  "key": "new"
220.                }
221.              }
222.            },
223.            "id": "Marketing Mars-MM-2",
224.            "_timestamp": "2024-11-01T17:52:42.711-0300",
225.            "Key": "MM-2",
226.            "_allow_access_control": [
227.              "account_id:712020:88983800-6c97-469a-9451-79c2dd3732b5",
228.              "name:Tomas-Murua"
229.            ]
230.          }
231.        },
232.        {
233.          "_index": "galactic_documents",
234.          "_id": "2",
235.          "_score": 0.61183906,
236.          "_source": {
237.            "document_id": "GBFF-002",
238.            "title": "User Guide for the Galactic Banking App",
239.            "content": "Welcome to the Galactic Banking application by Interstellar Finance Corp. Here you can: Transfer galactic credits to any registered account across the Milky Way. Check your balance and manage your investments in real-time. Access interplanetary loans with ease. For your security, use multi-factor authentication each time you log in.",
240.            "release_date": "2024-01-01",
241.            "page_count": 3,
242.            "tags": [
243.              "user guide",
244.              "application"
245.            ]
246.          }
247.        },
248.        {
249.          "_index": "galactic_documents",
250.          "_id": "3",
251.          "_score": 0.5029222,
252.          "_source": {
253.            "document_id": "GBFF-003",
254.            "title": "Technical Specifications Report - Galactic Banking Project",
255.            "content": "This report details the technical architecture of the Galactic Banking application: Microservices-based backend for scalability and performance. Secure communication protocols utilizing quantum encryption. Transaction management adapted to environments with gravity variations and time dilation.",
256.            "release_date": "2024-01-01",
257.            "page_count": 7,
258.            "tags": [
259.              "technical",
260.              "specifications",
261.              "architecture"
262.            ]
263.          }
264.        }
265.      ]
266.    }
267.  }

`![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)

如果文档太长,你可以将选项 _source 添加到查询中,以仅包含你需要的字段。如果你只想删除一些字段,我们将在本系列的第二部分介绍该选项。

文档级安全性 (DLS)

我们现在将配置文档级安全性 (DLS),以将 Jira 权限与 Elasticsearch 中的权限相匹配,以便用户搜索时只能看到他们在 Jira 中被允许看到的内容。

首先,我们将转到 Elastic Cloud 中连接器的控制面板,然后单击 Access Control Sync。

此同步将带来 Jira 用户的访问和权限信息。为了测试这一点,我创建了另一个 Jira 板(board),但用户 “Gustavo” 无权访问该板。

注意:创建板后,不要忘记运行内容同步。你可以运行一次性同步,也可以按计划运行

让我们开始检查新板中的文档是否存在:



1.  GET bank/_search
2.  {
3.    "_source": ["Issue.summary"],
4.    "query": {
5.     "match": {
6.       "Issue.project.name": "Marketing Mars"
7.     }
8.    }
9.  }


我们可以有效地看到以下问题:



1.  {
2.    "took": 2,
3.    "timed_out": false,
4.    "_shards": {
5.      "total": 2,
6.      "successful": 2,
7.      "skipped": 0,
8.      "failed": 0
9.    },
10.    "hits": {
11.      "total": {
12.        "value": 3,
13.        "relation": "eq"
14.      },
15.      "max_score": 0.7473189,
16.      "hits": [
17.        {
18.          "_index": "bank",
19.          "_id": "Marketing Mars-MM-1",
20.          "_score": 0.7473189,
21.          "_source": {
22.            "Issue": {
23.              "summary": "Conquer Mars"
24.            }
25.          }
26.        },
27.        {
28.          "_index": "bank",
29.          "_id": "Marketing Mars-MM-3",
30.          "_score": 0.7473189,
31.          "_source": {
32.            "Issue": {
33.              "summary": "Conquering Earth"
34.            }
35.          }
36.        },
37.        {
38.          "_index": "bank",
39.          "_id": "Marketing Mars-MM-2",
40.          "_score": 0.7473189,
41.          "_source": {
42.            "Issue": {
43.              "summary": "Conquer the moon"
44.            }
45.          }
46.        }
47.      ]
48.    }
49.  }


但是,由于用户 “Gustavo” 没有访问权限,因此他应该无法看到它们。

让我们在 ACL 过滤器索引中查找用户的文档以查看他们的权限。

GET .search-acl-filter-bank/_search

响应:



1.  {
2.    "_index": ".search-acl-filter-bank",
3.    "_id": "63c04b092341bff4fff6e0cb",
4.    "_score": 1,
5.    "_source": {
6.      "created_at": "2024-11-01T23:19:35.784996+00:00",
7.      "id": "63c04b092341bff4fff6e0cb",
8.      "_timestamp": "2024-11-01T05:42:04.410478+00:00",
9.      "identity": {
10.        "account_id": "account_id:63c04b092341bff4fff6e0cb",
11.        "email_address": null,
12.        "display_name": "name:Gustavo",
13.        "locale": "locale:en_US"
14.      },
15.      "query": {
16.        "template": {
17.          "source": """{
18.            "bool": {
19.              "should": [
20.                {
21.                  "bool": {
22.                    "must_not": {
23.                      "exists": {
24.                        "field": "_allow_access_control"
25.                      }
26.                    }
27.                  }
28.                },
29.                {
30.                  "terms": {
31.                    "_allow_access_control.enum": {{#toJson}}access_control{{/toJson}}
32.                  }
33.                }
34.              ]
35.            }
36.          }""",
37.          "params": {
38.            "access_control": [
39.              "account_id:63c04b092341bff4fff6e0cb",
40.              "group_id:d3f28403-7e99-4262-8f11-77a75bcd33d8",
41.              "role_key:jira-software"
42.            ]
43.          }
44.        }
45.      }
46.    }
47.  }


该索引包括用户 ID 及其所有 Jira 组。我们需要将用户访问控制中的内容与每个文档中的字段 _allowed_access_control 进行匹配。

我们将使用以下命令为 Gustavo 创建 API 密钥。你必须从上一步复制 query.template 值:



1.  POST /_security/api_key
2.  {
3.    "name": "gustavo",
4.    "expiration": "30d",
5.    "role_descriptors": {
6.      "jira-role": {
7.        "index": [
8.          {
9.            "names": [
10.              "bank",
11.              "galactic_documents"
12.            ],
13.            "privileges": [
14.              "read",
15.              "view_index_metadata"
16.            ],
17.            "query": {
18.              "template": {
19.                "params": {
20.                  "access_control": [
21.                    "account_id:63c04b092341bff4fff6e0cb",
22.                    "group_id:d3f28403-7e99-4262-8f11-77a75bcd33d8",
23.                    "role_key:jira-software"
24.                  ]
25.                },
26.                "source": """{
27.                  "bool": {
28.                    "should": [
29.                      {
30.                        "bool": {
31.                          "must_not": {
32.                            "exists": {
33.                              "field": "_allow_access_control"
34.                            }
35.                          }
36.                        }
37.                      },
38.                      {
39.                        "terms": {
40.                          "_allow_access_control.enum": {{#toJson}}access_control{{/toJson}}
41.                        }
42.                      }
43.                    ]
44.                  }
45.                }"""
46.              }
47.            }
48.          }
49.        ]
50.      }
51.    }
52.  }


请注意,我们仅通过此选项授予对本文中索引的访问权限。

为 Gustavo 创建 API 密钥的响应如下:



1.  {
2.    "id": "yLa1FJMBU4bZPaw5Stnl",
3.    "name": "gustavo",
4.    "expiration": 1733811245816,
5.    "api_key": "UrGdsnDFSyGxjQvLayw5jQ",
6.    "encoded": "eUxhMUZKTUJVNGJaUGF3NVN0bmw6VXJHZHNuREZTeUd4alF2TGF5dzVqUQ=="
7.  }


你可以使用 curl 来测试我们是否可以使用 API KEY 运行搜索,并且它不会从 Marketing board 获取信息,因为 Gustavo 无权访问它。



1.  curl --location --request GET 'https://interstellar-finance-corp.es.us-central1.gcp.cloud.es.io/bank/_search' \
2.  --header 'Authorization: ApiKey eUxhMUZKTUJVNGJaUGF3NVN0bmw6VXJHZHNuREZTeUd4alF2TGF5dzVqUQ==' \
3.  --header 'Content-Type: application/json' \
4.  --data '{
5.    "_source": ["Issue.summary"],
6.    "query": {
7.     "match": {
8.       "Issue.project.name": "Marketing Mars"
9.     }
10.    }
11.  }'


响应:



1.  {
2.    "took": 0,
3.    "timed_out": false,
4.    "_shards": {
5.      "total": 1,
6.      "successful": 1,
7.      "skipped": 0,
8.      "failed": 0
9.    },
10.    "hits": {
11.      "total": {
12.        "value": 0,
13.        "relation": "eq"
14.      },
15.      "max_score": null,
16.      "hits": []
17.    }
18.  }


我们可以看到,Gustavo 没有获得任何信息,因为他没有访问权限。现在,让我们用他被允许查看的 board 文件进行测试:



1.  curl --location --request GET 'https://interstellar-finance-corp.es.us-central1.gcp.cloud.es.io/bank/_search?pretty=true' \
2.  --header 'Authorization: ApiKey eUxhMUZKTUJVNGJaUGF3NVN0bmw6VXJHZHNuREZTeUd4alF2TGF5dzVqUQ==' \
3.  --header 'Content-Type: application/json' \
4.  --data '{
5.    "_source": ["Issue.summary"],
6.    "query": {
7.     "match": {
8.       "Issue.project.name": "Galactic Banking Project"
9.     }
10.    }
11.  }'


响应:



1.  {
2.    "took" : 7,
3.    "timed_out" : false,
4.    "_shards" : {
5.      "total" : 2,
6.      "successful" : 2,
7.      "skipped" : 0,
8.      "failed" : 0
9.    },
10.    "hits" : {
11.      "total" : {
12.        "value" : 3,
13.        "relation" : "eq"
14.      },
15.      "max_score" : 3.1784885,
16.      "hits" : [
17.        {
18.          "_index" : "bank",
19.          "_id" : "Galactic Banking Project-GBP-3",
20.          "_score" : 3.1784885,
21.          "_source" : {
22.            "Issue" : {
23.              "summary" : "Intergalactic Security and Compliance"
24.            }
25.          }
26.        },
27.        {
28.          "_index" : "bank",
29.          "_id" : "Galactic Banking Project-GBP-2",
30.          "_score" : 0.5469647,
31.          "_source" : {
32.            "Issue" : {
33.              "summary" : "Bank Application Frontend"
34.            }
35.          }
36.        },
37.        {
38.          "_index" : "bank",
39.          "_id" : "Galactic Banking Project-GBP-1",
40.          "_score" : 0.5469647,
41.          "_source" : {
42.            "Issue" : {
43.              "summary" : "Development of API for International Transfers"
44.            }
45.          }
46.        }
47.      ]
48.    }
49.  }


结论

如你所见,将 Elasticsearch 与 Jira 集成有许多好处,例如能够对你正在处理的所有项目进行统一搜索,以及能够在多个数据源中运行更高级的搜索。添加的 DLS 是一种快速简便的方法,可确保用户保持他们在原始源中已有的访问权限。

想要获得 Elastic 认证?了解下一次 Elasticsearch 工程师培训何时开始!

Elasticsearch 包含新功能,可帮助你为你的用例构建最佳搜索解决方案。深入了解我们的示例笔记本以了解更多信息,开始免费云试用,或立即在你的本地机器上试用 Elastic。

原文:Jira connector tutorial part I - Elasticsearch Labs