我在 nodejs 中使用过 Elasticsearch 。但是现在对于 java 应用程序,我需要 elasticsearch。于是看了elasticsearch官网的文档。但是我不能跟上一件事
我已经在 Eclipse 中安装了 Maven 插件。 我已经在我的项目中的 pom.xml 中完成了依赖设置。
<dependencies>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>1.5.0</version>
</dependency>
</dependencies>
但是每当我在 java 中写下一行时,它都会说无法解析。
import static org.elasticsearch.node.NodeBuilder.*;
所以我无法在 java 中使用 Elasticsearch 。
我已将此作为来源阅读
https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/index.html
最佳答案
我不确定你在这里做什么,你不应该手动下载 jar 并作为项目依赖项添加到 eclipse。请通过this了解 Maven 依赖项如何工作的教程。相关文字如下:
Maven connects to remote repositories (or you can set up your own local repos) and automatically downloads all of the dependencies needed to build your project. For example, lets say you have a project that uses Apache's Camel routing tool, version 2.10.6, but a new version of Camel is released, 2.11.1. Instead of having to go to Apache's website, download the 2.11.1 distribution and replace 2.10.6 with it, you can just tell Maven to use the new distribution and the work will be done for you.
关于java - 无法设置 Elasticsearch JAVA API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30803596/