我有一个使用Jhipter生成器构建的应用程序,它基于Spring Boot.最新版本的Jhipster允许您将Elasticsearch作为选项包含在内,因此我有一个应用程序在开发模式下运行Elasticsearch的嵌入式实例,并以生产模式连接到服务器实例.
当应用程序在开发模式下运行时,它可以很好地连接到嵌入式实例,但如果我尝试连接到外部实例,我在控制台上会收到以下错误:
ERROR 7804 --- [restartedMain] .dersAbstractElasticsearchRepository:无法加载elasticsearch节点:org.elasticsearch.client.transport.NoNodeAvailableException:所有已配置的节点均不可用:[{#transport#-1} {127.0.0.1} {127.0 .0.1:9300}]
我的应用程序使用的是Spring启动版本1.4.0.RELEASE,根据elasticsearch.yml,该应用程序有弹性搜索2.3.5
我的application-prod.yml设置:
spring:
data:
elasticsearch:
cluster-name:
cluster-nodes: localhost:9300
Run Code Online (Sandbox Code Playgroud)
默认的ElasticSearchConfiguration是:
@Configuration
public class ElasticSearchConfiguration {
@Bean
public ElasticsearchTemplate elasticsearchTemplate(Client client, Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder) {
return new ElasticsearchTemplate(client, new CustomEntityMapper(jackson2ObjectMapperBuilder.createXmlMapper(false).build()));
}
}
Run Code Online (Sandbox Code Playgroud)
我覆盖了:
@Configuration
public class ElasticSearchConfiguration {
@Value("${spring.data.elasticsearch.cluster-name}")
private String clusterName;
@Value("${spring.data.elasticsearch.cluster-nodes}")
private String clusterNodes;
@Bean
public ElasticsearchTemplate elasticsearchTemplate() throws UnknownHostException {
String server = clusterNodes.split(":")[0];
Integer port = Integer.parseInt(clusterNodes.split(":")[1]);
Settings settings = Settings.settingsBuilder()
.put("cluster.name", clusterName).build(); …Run Code Online (Sandbox Code Playgroud) 我在java中有一个项目,我使用弹性搜索2.3.3索引数据.索引有两种类型.
我的索引文档看起来像:
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 1,
"hits": [
{
"_index": "test_index",
"_type": "movies",
"_id": "uReb0g9KSLKS18sTATdr3A",
"_score": 1,
"_source": {
"genre": "Thriller"
}
},
{
"_index": "test_index",
"_type": "drama",
"_id": "cReb0g9KSKLS18sTATdr3B",
"_score": 1,
"_source": {
"genre": "SuperNatural"
}
},
{
"_index": "index1",
"_type": "drama",
"_id": "cReb0g9KSKLS18sT76ng3B",
"_score": 1,
"_source": {
"genre": "Romance"
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
我需要删除特定名称的索引和类型.
例如: -从上面的doc,我想删除名为"test_index"的索引并输入"drama". …
我正在尝试在我的 angular 9 应用程序中构建linkedin 登录功能。我将angularx-social-login npm 包用于 google 和 facebook 登录,但它不能用于linkedin。
所以我使用linkedin api来登录。
代码:-
authWindow: any;
linkedInLogin() {
this.createOauthWindow();
}
createOauthWindow(width = 500, height = 600) {
const clientId = 'my_client_id';
const redirectUri = window.location.origin;
const responseType = 'code';
const scope = 'r_liteprofile';
const url = `https://www.linkedin.com/oauth/v2/authorization?client_id=${clientId}&redirect_uri=${redirectUri}&scope=${scope}&response_type=${responseType}`;
const left = (screen.width / 2) - (width / 2);
const top = (screen.height / 2) - (height / 2);
const options = `directories=no, titlebar=no, toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=no,
copyhistory=no, …Run Code Online (Sandbox Code Playgroud) java ×2
angular ×1
java-api ×1
jhipster ×1
linkedin-api ×1
oauth-2.0 ×1
spring ×1
spring-boot ×1