Giter VIP home page Giter VIP logo

spring-projects / spring-data-elasticsearch Goto Github PK

View Code? Open in Web Editor NEW
2.9K 258.0 1.3K 44.63 MB

Provide support to increase developer productivity in Java when using Elasticsearch. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.

Home Page: https://spring.io/projects/spring-data-elasticsearch/

License: Apache License 2.0

Java 98.39% CSS 1.00% Shell 0.04% Kotlin 0.57%

spring-data-elasticsearch's Introduction

Spring Data for Elasticsearch icon?job=spring data elasticsearch%2Fmain&subject=Build Gitter Revved up by Develocity

The primary goal of the Spring Data project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.

The Spring Data Elasticsearch project provides integration with the Elasticsearch search engine. Key functional areas of Spring Data Elasticsearch are a POJO centric model for interacting with Elasticsearch Documents and easily writing a Repository style data access layer.

This project is lead and maintained by the community.

Features

  • Spring configuration support using Java based @Configuration classes or an XML namespace for an ES client instances.

  • ElasticsearchOperations class and implementations that increases productivity performing common ES operations. Includes integrated object mapping between documents and POJOs.

  • Feature Rich Object Mapping integrated with Spring’s Conversion Service

  • Annotation based mapping metadata

  • Automatic implementation of Repository interfaces including support for custom search methods.

  • CDI support for repositories

Code of Conduct

This project is governed by the Spring Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to [email protected].

Getting Started

Here is a quick teaser of an application using Spring Data Repositories in Java:

public interface PersonRepository extends CrudRepository<Person, Long> {

  List<Person> findByLastname(String lastname);

  List<Person> findByFirstnameLike(String firstname);
}

@Service
public class MyService {

  private final PersonRepository repository;

  public MyService(PersonRepository repository) {
    this.repository = repository;
  }

  public void doWork() {

    repository.deleteAll();

    Person person = new Person();
    person.setFirstname("Oliver");
    person.setLastname("Gierke");
    repository.save(person);

    List<Person> lastNameResults = repository.findByLastname("Gierke");
    List<Person> firstNameResults = repository.findByFirstnameLike("Oli");
 }
}

Maven configuration

Add the Maven dependency:

<dependency>
  <groupId>org.springframework.data</groupId>
  <artifactId>spring-data-elasticsearch</artifactId>
  <version>${version}</version>
</dependency>

Compatibility Matrix

The compatibility between Spring Data Elasticsearch, Elasticsearch client drivers and Spring Boot versions can be found in the reference documentation.

To use the Release candidate versions of the upcoming major version, use our Maven milestone repository and declare the appropriate dependency version:

<dependency>
  <groupId>org.springframework.data</groupId>
  <artifactId>spring-data-elasticsearch</artifactId>
  <version>${version}.RCx</version> <!-- x being 1, 2, ... -->
</dependency>

<repository>
  <id>spring-snapshot</id>
  <name>Spring Snapshot Repository</name>
  <url>https://repo.spring.io/milestone</url>
</repository>

If you’d rather like the latest snapshots of the upcoming major version, use our Maven snapshot repository and declare the appropriate dependency version:

<dependency>
  <groupId>org.springframework.data</groupId>
  <artifactId>spring-data-elasticsearch</artifactId>
  <version>${version}-SNAPSHOT</version>
</dependency>

<repository>
  <id>spring-snapshot</id>
  <name>Spring Snapshot Repository</name>
  <url>https://repo.spring.io/snapshot</url>
</repository>

Getting Help

Having trouble with Spring Data? We’d love to help!

Reporting Issues

Spring Data uses GitHub as issue tracking system to record bugs and feature requests. If you want to raise an issue, please follow the recommendations below:

  • Before you log a bug, please search the issue tracker to see if someone has already reported the problem.

  • If the issue doesn’t already exist, create a new issue.

  • Please provide as much information as possible with the issue report, we like to know the version of Spring Data Elasticsearch that you are using and JVM version.

  • If you need to paste code, or include a stack trace use Markdown ``` escapes before and after your text.

  • If possible try to create a test-case or project that replicates the issue. Attach a link to your code or a compressed file containing your code.

Building from Source

You don’t need to build from source to use Spring Data (binaries in repo.spring.io), but if you want to try out the latest and greatest, Spring Data can be easily built with the maven wrapper.

You need JDK 17 or above to build the main branch. For the branches up to and including release 4.4, JDK 8 is required.

 $ ./mvnw clean install

If you want to build with the regular mvn command, you will need Maven v3.5.0 or above.

Also see CONTRIBUTING.adoc if you wish to submit pull requests, and in particular please sign the Contributor’s Agreement before submitting your first pull request.

Important
When contributing, please make sure an issue exists in issue tracker and comment on this issue with how you want to address it. By this we not only know that someone is working on an issue, we can also align architectural questions and possible solutions before work is invested . We so can prevent that much work is put into Pull Requests that have little or no chances of being merged.

Building reference documentation

Building the documentation builds also the project without running tests.

 $ ./mvnw clean install -Pantora

The generated documentation is available from target/antora/site/index.html.

Examples

For examples on using the Spring Data for Elasticsearch, see the spring-data-examples project.

License

Spring Data for Elasticsearch Open Source software released under the Apache 2.0 license.

spring-data-elasticsearch's People

Contributors

akonczak avatar alesharik avatar amwaheed avatar antonlgvs avatar christophstrobl avatar ffaoudi avatar fhopf avatar fmarchand avatar gonmmarques avatar gregturn avatar hobbut avatar junghoon-vans avatar jxblum avatar kevinleturc avatar mawen12 avatar michalj avatar mohsinh avatar mp911de avatar odrotbohm avatar pnowak85 avatar puppylpg avatar puug avatar rpuch avatar schauder avatar sothawo avatar spring-builds avatar stuartstevenson avatar sxhinzvc avatar xhaggi avatar youssef3wi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-data-elasticsearch's Issues

Upgrading to elasticsearch 0.90.0

I noticed this project requires the 0.20.5 release of elasticsearch. Is there a plan to upgrade to the current release, 0.90.0? I did the upgrade on a fork this morning but there are a number of unit test failures, especially around ElasticsearchRepository.searchSimilar().

Is 0.90.0 support something the project is interested in moving towards in the near future? If so, I may invest more time in getting the similar search working.

Support elastic:http-client

Hi,

I just wonder why there is no support for http client.
I can use the Spring's RestTemplate but I think there will be some boiler-plat codes to do that. Why don't you support elastic:http-client likes elastic:transport-client or elastic:node-client.

Thanks.

Add support for TransportClient additional parameters such as client.transport.ignore_cluster_name, client.transport.ping_timeout, client.transport.nodes_sampler_interval [DATAES-22]

Mohsin Husen opened DATAES-22 and commented

Add support for TransportClient additional parameters such as client.transport.ignore_cluster_name, client.transport.ping_timeout, client.transport.nodes_sampler_interval

http://www.elasticsearch.org/guide/reference/java-api/client/


Affects: 1.0 M1

Referenced from: commits 5a34a90

FacetResult extension is not possible

Hi,

There are only 2 kinds of facets implemented (Term and Range), and it is impossible to extend spring-data-elasticsearch to add a new facet type because the call of the FacetMapper is done in a static way and the ResultsMapper is an anonymous class instantiate at each call.
It would be interesting to make configurable the FacetMapper or the ResultMapper in order to allow extension.

Thanks

Add support for Index level configuration

Index level configuration is needed to identify number of shards , number of replicas, refresh-interval etc. Currently test cases uses default configuration which is 5 shards and 1 replica which is causing to much overload on CPU and RAM

spirng-data-elasticsearch with elasticsearch-river-mongodb

Hi,

I have created on my local host using elastic search and elasticsearch river mongodb an idex for a collection from a mongodb database.
Is it possible to connect from my spring project using spring-data-elasticsearch to the index already created in elastic search?
I tried to add the spring-data-elasticsearch configurations to my project using a using Node Client but when I try to make a simple search I get "org.elasticsearch.indices.IndexMissingException,
Thank you

Allow @Field Annotation to be used on setter methods [DATAES-20]

Petar Tahchiev opened DATAES-20 and commented

Hi guys,

for me it's really critical to be able to use the org.springframework.data.elasticsearch.annotations.Field annotation on setter methods as well (just as the Field annotation from SolrJ). The reason is that I have a common POJO called SearchProduct, which defines attributes, and then the two POJOs that extend it (SolrSearchProduct and ElasticSearchProduct) define the setterMethods, with the appropriate @Field annotations. I have created a patch that works for me. Unfortunately the tests were failing for me even before my changes so I'm not sure if I broke any of them. Please inspect the patch and if it looks ok, apply it. Thank you


Attachments:

Issue Links:

  • DATAES-568 MappingBuilder must use the @Field annotation's name attribute
    ("is superseded by")

3 votes, 5 watchers

java.lang.NoSuchMethodError: org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty.isVersionProperty()Z

I added the spring-data-elasticsearch dependency to my project (see tree of dependencies below ) and i get a java.lang.NoSuchMethodError: org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty.isVersionProperty()Z

--- maven-dependency-plugin:2.1:tree (default-cli) @ MMS ---
com.moviri.com:MMS:war:1.0
+- org.springframework:spring-core:jar:3.2.2.RELEASE:compile
| - commons-logging:commons-logging:jar:1.1.1:compile
+- org.springframework:spring-context:jar:3.2.2.RELEASE:compile
| +- org.springframework:spring-aop:jar:3.2.2.RELEASE:compile
| +- org.springframework:spring-beans:jar:3.2.2.RELEASE:compile
| - org.springframework:spring-expression:jar:3.2.2.RELEASE:compile
+- org.springframework:spring-web:jar:3.2.2.RELEASE:compile
| - aopalliance:aopalliance:jar:1.0:compile
+- org.springframework:spring-webmvc:jar:3.2.2.RELEASE:compile
+- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
+- org.hibernate:hibernate-entitymanager:jar:4.1.9.Final:compile
| +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
| +- org.javassist:javassist:jar:3.17.1-GA:compile
| +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
| +- dom4j:dom4j:jar:1.6.1:compile
| +- org.hibernate:hibernate-core:jar:4.1.9.Final:compile
| | - antlr:antlr:jar:2.7.7:compile
| - org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
+- cglib:cglib:jar:2.2.2:compile
| - asm:asm:jar:3.3.1:compile
+- org.springframework.data:spring-data-rest-webmvc:jar:1.1.0.M1:compile
| +- org.springframework.data:spring-data-rest-repository:jar:1.1.0.M1:compile
| | +- com.google.code.findbugs:jsr305:jar:2.0.1:compile
| | +- org.springframework.data:spring-data-rest-core:jar:1.1.0.M1:compile
| | | +- cglib:cglib-nodep:jar:2.2.2:runtime
| | | +- org.springframework.hateoas:spring-hateoas:jar:0.4.0.RELEASE:compile
| | | - com.google.guava:guava:jar:13.0.1:compile
| | +- org.springframework.plugin:spring-plugin-core:jar:0.8.0.RELEASE:compile
| | - com.fasterxml.jackson.core:jackson-databind:jar:2.1.2:compile
| | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.1.1:compile
| | - com.fasterxml.jackson.core:jackson-core:jar:2.1.1:compile
| +- org.slf4j:jcl-over-slf4j:jar:1.7.2:runtime
| - org.slf4j:slf4j-api:jar:1.7.2:compile
+- mysql:mysql-connector-java:jar:5.1.25:compile
+- joda-time:joda-time:jar:2.2:compile
+- joda-time:joda-time-hibernate:jar:1.3:compile
+- org.jadira.usertype:usertype.core:jar:3.1.0.CR1:compile
+- org.jadira.usertype:usertype.spi:jar:3.1.0.CR1:compile
+- org.jadira.usertype:usertype.jodatime:jar:2.0.1:compile
+- org.springframework.data:spring-data-elasticsearch:jar:1.0.0.BUILD-SNAPSHOT:compile
| +- org.springframework:spring-tx:jar:3.1.4.RELEASE:compile
| +- org.springframework.data:spring-data-commons:jar:1.6.0.BUILD-SNAPSHOT:compile
| +- commons-lang:commons-lang:jar:2.6:compile
| - commons-collections:commons-collections:jar:3.2.1:compile
+- log4j:log4j:jar:1.2.17:compile
+- org.elasticsearch:elasticsearch:jar:0.90.0:compile
| +- org.apache.lucene:lucene-core:jar:4.2.1:compile
| +- org.apache.lucene:lucene-analyzers-common:jar:4.2.1:compile
| +- org.apache.lucene:lucene-codecs:jar:4.2.1:compile
| +- org.apache.lucene:lucene-queries:jar:4.2.1:compile
| +- org.apache.lucene:lucene-memory:jar:4.2.1:compile
| +- org.apache.lucene:lucene-highlighter:jar:4.2.1:compile
| +- org.apache.lucene:lucene-queryparser:jar:4.2.1:compile
| | - org.apache.lucene:lucene-sandbox:jar:4.2.1:compile
| +- org.apache.lucene:lucene-suggest:jar:4.2.1:compile
| +- org.apache.lucene:lucene-join:jar:4.2.1:compile
| | - org.apache.lucene:lucene-grouping:jar:4.2.1:compile
| - org.apache.lucene:lucene-spatial:jar:4.2.1:compile
| - com.spatial4j:spatial4j:jar:0.3:compile

  • org.codehaus.jackson:jackson-mapper-asl:jar:1.9.2:compile
    • org.codehaus.jackson:jackson-core-asl:jar:1.9.2:compile

This is the full exception

Caused by: java.lang.NoSuchMethodError: org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty.isVersionProperty()Z
at org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchPersistentEntity.addPersistentProperty(SimpleElasticsearchPersistentEntity.java:110)
at org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchPersistentEntity.addPersistentProperty(SimpleElasticsearchPersistentEntity.java:42)
at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:396)
at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:570)
at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:281)
at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:190)
at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:159)
at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:69)
at org.springframework.data.elasticsearch.repository.support.ElasticsearchEntityInformationCreatorImpl.getEntityInformation(ElasticsearchEntityInformationCreatorImpl.java:44)
at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory.getEntityInformation(ElasticsearchRepositoryFactory.java:57)
at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory.getTargetRepository(ElasticsearchRepositoryFactory.java:64)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:137)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:125)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:41)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)

Build fails

When I try to build the project
mvn install
I get an error:
~/projects/spring-data-elasticsearch-master mvn install
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.springframework.data:spring-data-elasticsearch:1.0.0.BUILD-SNAPSHOT (/Users/cmpich/projects/spring-data-elasticsearch-master/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Failure to find org.springframework.data.build:spring-data-parent:pom:1.1.0.BUILD-SNAPSHOT in http://repo.springsource.org/lib-snapshot-local was cached in the local repository, resolution will not be reattempted until the update interval of spring-libs-snapshot has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 10, column 10 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
~/projects/spring-data-elasticsearch-master

Exception while using CustomRepository

Hi, i tried to use functionality (like in spring data jpa) of custom repository methods.

I had the repository interface in package which configured for spring data elastic search :

public interface TestrunSetRepository extends ElasticsearchRepository<TestrunSetDocument, String>, TestrunSetRepositoryCustom {

}

I had implementation of TestrunSetRepositoryCustom

public class TestrunSetRepositoryCustomImpl implements
        TestrunSetRepositoryCustom {

    private ElasticsearchTemplate elasticsearchTemplate;

    public void setElasticsearchTemplate(ElasticsearchTemplate elasticsearchTemplate) {
        this.elasticsearchTemplate = elasticsearchTemplate;
    }

    @Override
    public List<String> getUniqueCategoriesDe() {
        return null;
    }
}

applicationContext.xml:

    <elasticsearch:repositories base-package="some.repositories.es" />
    <elasticsearch:transport-client id="esClient" 
        cluster-nodes="#{@'some.elasticsearch.cluster.nodes'}"
        cluster-name="#{@'some.elasticsearch.cluster.name'}"/>
    <bean id="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
        <constructor-arg name="client" ref="esClient"/>
    </bean>
    <bean id="testrunSetRepositoryCustom" 
        class="some.repositories.es.impl.TestrunSetRepositoryCustomImpl">
        <property name="elasticsearchTemplate" ref="elasticsearchTemplate"/>
    </bean>

but while initializing spring context I got this exception:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testrunSetRepository': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1454)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:249)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:270)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323)
    ... 63 more
Caused by: java.lang.NullPointerException
    at org.springframework.data.elasticsearch.repository.support.MappingElasticsearchEntityInformation.<init>(MappingElasticsearchEntityInformation.java:53)
    at org.springframework.data.elasticsearch.repository.support.MappingElasticsearchEntityInformation.<init>(MappingElasticsearchEntityInformation.java:49)
    at org.springframework.data.elasticsearch.repository.support.ElasticsearchEntityInformationCreatorImpl.getEntityInformation(ElasticsearchEntityInformationCreatorImpl.java:46)
    at org.springframework.data.elasticsearch.repository.query.ElasticsearchQueryMethod.<init>(ElasticsearchQueryMethod.java:42)
    at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory$ElasticsearchQueryLookupStrategy.resolveQuery(ElasticsearchRepositoryFactory.java:108)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:290)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:158)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:162)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:44)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)

"Or" criteria in CriteriaQuery is not getting generated correctly [DATAES-30]

Mohsin Husen opened DATAES-30 and commented

"Or" criteria in Criteria Query is not getting generated correctly.

Input :

CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria("message").contains("some").or("message")
				.contains("test"));

Expected JSON query :


{
  "bool" : {
    "must" : {
    "should" : {
      "field" : {
        "message" : {
          "query" : "*some*",
          "analyze_wildcard" : true
        }
      }
    },
    "should" : {
      "field" : {
        "message" : {
          "query" : "*test*",
          "analyze_wildcard" : true
        }
      }
    }
  }
 }
}

Actual Query

{
  "bool" : {
    "must" : {
      "field" : {
        "message" : {
          "query" : "*some*",
          "analyze_wildcard" : true
        }
      }
    },
    "should" : {
      "field" : {
        "message" : {
          "query" : "*test*",
          "analyze_wildcard" : true
        }
      }
    }
  }
}

1 votes, 3 watchers

Compilation issue with 0.90.5. (ElasticsearchTemplate.refresh API)

public void refresh(String indexName, boolean waitForOperation) {
client.admin().indices().refresh(refreshRequest(indexName).waitForOperations(waitForOperation)).actionGet();
public void refresh(Class clazz, boolean waitForOperation) {
ElasticsearchPersistentEntity persistentEntity = getPersistentEntityFor(clazz);
client.admin().indices()
.refresh(refreshRequest(persistentEntity.getIndexName()).force(waitForOperation)).actionGet();
}

waitForOperations needs to be replaced with force

Elasticsearch + elasticsearch-river-rabbitmq

I am using spring-data-elasticsearch for a project and we kind of need async operation to improve performance during upsert/indexing. Am wondering is there anyway I can use spring-data-elasticsearch to push data to elasticsearch-river-rabbitmq.

Thanks !

Autogenerated elastic search id isn't returned

I have got the Repository:

public interface TestrunSetRepository extends ElasticsearchRepository<TestrunSetDocument, String> {
}

I've got the POJO TestrunSetDocument

@Document(indexName = TestrunSet.ES_INDEX, type = TestrunSet.ES_TYPE)
public class TestrunSetDocument extends TestrunSet {
    @Id
    private String id;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
}

I write in Elastic Search without ids, so I want these would to be generated by ES for me.

when I make testrunSetRepository.findAll (ore findOne) I dont get the ids in POJO:
id field is just null.

What am I doing wrong?

Add Support to specify Index Name and type in Delete Query [DATAES-18]

Deepesh Naini opened DATAES-18 and commented

Currently when we want to delete a document using Delete Query there is no option to specify Index name and type, the only available option is to specify them as part of document annotation in Entity class. Using that option we can only have static name and type and we want to specify Index name and type at the time of query similar to what we have in SearchQuery class


Referenced from: commits 1152e00

problem with ES 0.9.5

with ES 0.9.2, ie works well,
with ES 0.9.5, the exception as following:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.RepositoryTest': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ESApproveRepository': FactoryBean threw exception on object creation; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: No node available
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:376)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:312)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ESApproveRepository': FactoryBean threw exception on object creation; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: No node available
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1454)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:438)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:416)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:550)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:150)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:303)
... 26 more
Caused by: org.elasticsearch.client.transport.NoNodeAvailableException: No node available
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:179)
at org.elasticsearch.client.transport.support.InternalTransportIndicesAdminClient.execute(InternalTransportIndicesAdminClient.java:73)
at org.elasticsearch.client.support.AbstractIndicesAdminClient.exists(AbstractIndicesAdminClient.java:142)
at org.springframework.data.elasticsearch.core.ElasticsearchTemplate.indexExists(ElasticsearchTemplate.java:450)
at org.springframework.data.elasticsearch.core.ElasticsearchTemplate.createIndexIfNotCreated(ElasticsearchTemplate.java:446)
at org.springframework.data.elasticsearch.core.ElasticsearchTemplate.createIndex(ElasticsearchTemplate.java:108)
at org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.createIndex(AbstractElasticsearchRepository.java:74)
at org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.(AbstractElasticsearchRepository.java:69)
at org.springframework.data.elasticsearch.repository.support.NumberKeyedRepository.(NumberKeyedRepository.java:37)
at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory.getTargetRepository(ElasticsearchRepositoryFactory.java:73)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:147)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:162)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:44)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
... 39 more

Add the ability to index arbitrary JSON strings [DATAES-31]

Joshua Harrison opened DATAES-31 and commented

The traditional Java API allows you to run a setSource method, passing a JSON string. ES waves its magic wand and deals with any mapping you haven't already defined, allowing for some flexibility in the construction of objects being ingested.
This would be a very useful feature to have in spring-data-elasticsearch, as it affords some flexibility in dealing with data coming from others, who may or may not tell you before they start changing their data format around


Referenced from: commits 9b63f23, 9386129

Upgrade to FasterXML Jackson [DATAES-25]

Petar Tahchiev opened DATAES-25 and commented

Hi guys,

since Elasticsearch has moved to fasterxml I think it's time that SDE moves too. I have a project of 253 jars, and the only jackson1 jars are coming from SDE. I can't remove them, because then SDE will not work, but if I leave them on the classpath I get weird errors like "Unrecognized field, not marked as ignorable".

I also apply a very simple patch that will update the version to jackson2


Attachments:

Referenced from: commits 47c82a8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.