Package org.springframework.data.elasticsearch.core.query

Examples of org.springframework.data.elasticsearch.core.query.IndexQuery


    template.deleteIndex(LogEntity.class);
    template.createIndex(LogEntity.class);
    template.putMapping(LogEntity.class);

    SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    IndexQuery indexQuery1 = new LogEntityBuilder("1").action("update").date(dateFormatter.parse("2013-10-18 18:01")).code(2)
        .ip("10.10.10.1").buildIndex();

    IndexQuery indexQuery2 = new LogEntityBuilder("2").action("update").date(dateFormatter.parse("2013-10-19 18:02")).code(2)
        .ip("10.10.10.2").buildIndex();

    IndexQuery indexQuery3 = new LogEntityBuilder("3").action("update").date(dateFormatter.parse("2013-10-19 18:03")).code(2)
        .ip("10.10.10.3").buildIndex();

    IndexQuery indexQuery4 = new LogEntityBuilder("4").action("update").date(dateFormatter.parse("2013-10-19 18:04")).code(2)
        .ip("10.10.10.4").buildIndex();

    template.bulkIndex(Arrays.asList(indexQuery1, indexQuery2, indexQuery3, indexQuery4));
    template.refresh(LogEntity.class, true);
  }
View Full Code Here


  public SampleInheritedEntity build() {
    return result;
  }

  public IndexQuery buildIndex() {
    IndexQuery indexQuery = new IndexQuery();
    indexQuery.setId(result.getId());
    indexQuery.setObject(result);
    return indexQuery;
  }
View Full Code Here

  public StockPrice build() {
    return result;
  }

  public IndexQuery buildIndex() {
    IndexQuery indexQuery = new IndexQuery();
    indexQuery.setId(result.getId());
    indexQuery.setObject(result);
    return indexQuery;
  }
View Full Code Here

    assertThat("parents", parents, contains(hasProperty("id", is(parent1.getId()))));
  }

  private ParentEntity index(String parentId, String name) {
    ParentEntity parent = new ParentEntity(parentId, name);
    IndexQuery index = new IndexQuery();
    index.setId(parent.getId());
    index.setObject(parent);
    elasticsearchTemplate.index(index);

    return parent;
  }
View Full Code Here

    return parent;
  }

  private ChildEntity index(String childId, String parentId, String name) {
    ChildEntity child = new ChildEntity(childId, parentId, name);
    IndexQuery index = new IndexQuery();
    index.setId(child.getId());
    index.setObject(child);
    index.setParentId(child.getParentId());
    elasticsearchTemplate.index(index);

    return child;
  }
View Full Code Here

    elasticsearchTemplate.deleteIndex(ArticleEntity.class);
    elasticsearchTemplate.createIndex(ArticleEntity.class);
    elasticsearchTemplate.putMapping(ArticleEntity.class);
    elasticsearchTemplate.refresh(ArticleEntity.class, true);

    IndexQuery article1 = new ArticleEntityBuilder("1").title("article four").addAuthor(RIZWAN_IDREES).addAuthor(ARTUR_KONCZAK).addAuthor(MOHSIN_HUSEN).addAuthor(JONATHAN_YAN).score(10).buildIndex();
    IndexQuery article2 = new ArticleEntityBuilder("2").title("article three").addAuthor(RIZWAN_IDREES).addAuthor(ARTUR_KONCZAK).addAuthor(MOHSIN_HUSEN).addPublishedYear(YEAR_2000).score(20).buildIndex();
    IndexQuery article3 = new ArticleEntityBuilder("3").title("article two").addAuthor(RIZWAN_IDREES).addAuthor(ARTUR_KONCZAK).addPublishedYear(YEAR_2001).addPublishedYear(YEAR_2000).score(30).buildIndex();
    IndexQuery article4 = new ArticleEntityBuilder("4").title("article one").addAuthor(RIZWAN_IDREES).addPublishedYear(YEAR_2002).addPublishedYear(YEAR_2001).addPublishedYear(YEAR_2000).score(40).buildIndex();

    elasticsearchTemplate.index(article1);
    elasticsearchTemplate.index(article2);
    elasticsearchTemplate.index(article3);
    elasticsearchTemplate.index(article4);
View Full Code Here

    elasticsearchTemplate.deleteIndex(ArticleEntity.class);
    elasticsearchTemplate.createIndex(ArticleEntity.class);
    elasticsearchTemplate.putMapping(ArticleEntity.class);
    elasticsearchTemplate.refresh(ArticleEntity.class, true);

    IndexQuery article1 = new ArticleEntityBuilder("1").title("article four").subject("computing").addAuthor(RIZWAN_IDREES).addAuthor(ARTUR_KONCZAK).addAuthor(MOHSIN_HUSEN).addAuthor(JONATHAN_YAN).score(10).buildIndex();
    IndexQuery article2 = new ArticleEntityBuilder("2").title("article three").subject("computing").addAuthor(RIZWAN_IDREES).addAuthor(ARTUR_KONCZAK).addAuthor(MOHSIN_HUSEN).addPublishedYear(YEAR_2000).score(20).buildIndex();
    IndexQuery article3 = new ArticleEntityBuilder("3").title("article two").subject("computing").addAuthor(RIZWAN_IDREES).addAuthor(ARTUR_KONCZAK).addPublishedYear(YEAR_2001).addPublishedYear(YEAR_2000).score(30).buildIndex();
    IndexQuery article4 = new ArticleEntityBuilder("4").title("article one").subject("accounting").addAuthor(RIZWAN_IDREES).addPublishedYear(YEAR_2002).addPublishedYear(YEAR_2001).addPublishedYear(YEAR_2000).score(40).buildIndex();

    elasticsearchTemplate.index(article1);
    elasticsearchTemplate.index(article2);
    elasticsearchTemplate.index(article3);
    elasticsearchTemplate.index(article4);
View Full Code Here

    public CompletionEntity build() {
  return result;
    }

    public IndexQuery buildIndex() {
  IndexQuery indexQuery = new IndexQuery();
  indexQuery.setId(result.getId());
  indexQuery.setObject(result);
  return indexQuery;
    }
View Full Code Here

    public CompletionEntity build() {
  return result;
    }

    public IndexQuery buildIndex() {
  IndexQuery indexQuery = new IndexQuery();
  indexQuery.setId(result.getId());
  indexQuery.setObject(result);
  return indexQuery;
    }
View Full Code Here

    public CompletionAnnotatedEntity build() {
  return result;
    }

    public IndexQuery buildIndex() {
  IndexQuery indexQuery = new IndexQuery();
  indexQuery.setId(result.getId());
  indexQuery.setObject(result);
  return indexQuery;
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.elasticsearch.core.query.IndexQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.