当我想从索引中删除项目时,它失败并向我们显示错误的下一条轨迹:
org.springframework.data.elasticsearch.ElasticsearchException:无法执行笑话动作, 响应码:403,错误:403禁止, 消息:我们计算出的请求签名与您提供的签名不匹配。 检查您的AWS Secret Access密钥和签名方法。有关详细信息,请查阅服务文档。
我已经在ElasticsearchRepository存储库中创建了一个“ removeBy ...”方法来从索引中删除项目:
public interface IndexSynonymRepository extends ElasticsearchRepository<IdxSynonym, Long> {
void removeByIdDashboardAndIdTable(Long idDashBoard, Long idTable);
}
合并到我的JAVA项目中的版本如下: POM配置版本:
<!-- Spring Data Jest ElasticSearch AWS -->
<dependency>
<groupId>com.github.vanroy</groupId>
<artifactId>spring-boot-starter-data-jest</artifactId>
<version>2.3.1.RELEASE</version>
</dependency>
<!-- Spring Data ElasticSearch -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<!-- Jest -->
<dependency>
<groupId>io.searchbox</groupId>
<artifactId>jest</artifactId>
<version>2.0.4</version>
</dependency>
<!-- ElasticSearch -->
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.4.4</version>
</dependency>
<!-- Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
<relativePath />
<!-- lookup parent from repository -->
</parent>
<!-- Aws Signing Request Interceptor -->
<dependency>
<groupId>vc.inreach.aws</groupId>
<artifactId>aws-signing-request-interceptor</artifactId>
<version>0.0.20</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>com.amazonaws</groupId>
</exclusion>
</exclusions>
</dependency>
我们在AWS中配置的角色策略如下:
Access Policy ElasticSearch:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "es:*",
"Resource": [
"arn:aws:es:us-east-1:XXXXXXXXXXXX:domain/my-domain/*",
"arn:aws:es:us-east-1:XXXXXXXXXXXX:domain/my-domain"
]
}
]
}
EC2 Role Policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"es:*"
],
"Resource": [
"arn:aws:es:us-east-1:XXXXXXXXXXXX:domain/my-domain",
"arn:aws:es:us-east-1:XXXXXXXXXXXX:domain/my-domain/*"
],
"Effect": "Allow"
}
]
}
我不知道这是否是许可证问题,或者我在签署申请时犯了一个错误。
我需要帮助来解决此问题。预先非常感谢。