java - 无法设置 Elasticsearch JAVA API

标签 java eclipse maven

我在 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

http://java.dzone.com/articles/elasticsearch-java-api

最佳答案

我不确定你在这里做什么,你不应该手动下载 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/

相关文章:

java - 如何将十进制数格式化为 2 位或 3 位数字?

scala - sbt- ManagedStyle.Maven

java - 应用程序可以在javaws中更改自己的名称吗?

java - SingleView ImageLoader 显示 NullPointerException

eclipse - git gc/git gui : Unlink of file <internal pack file name> failed

c - 向 Eclipse 项目添加 C/C++ 特性

Java 流 forEach concurrentModificationException 异常行为

java - 如何在Jsoup中删除部分网页?

maven - 如何循环目录中的文件,并根据每个文件名执行一些任务?

maven - 在 Jenkins Maven 作业中显示自定义测试结果