Giter VIP home page Giter VIP logo

play2-elasticsearch's People

Contributors

mguillermin avatar nboire avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

peter-fu

play2-elasticsearch's Issues

How to map custom object in toIndex and fromIndex methods?

Hi!

I wouldlike to know if there is a best practice to index a custom object in elasticsearch.

Example. I have a custom object MyObject:

public class CustomObject {
  private String name;
  private String value;

  // Constructor
  // ...........................................

  // Getters & Setters
  // ...........................................
}

Here is the ElasticSearch index object:

@IndexType(name = "myIndex")
public class MyObjectIndex extends Index {
  private static Finder<MyObjectIndex> find = ...................;
  private String id;
  private List<MyObject> myObjectList;

  // Getters & Setters
  // ..................................................

  @Override
  public Map toIndex(){
    Map<String, Object> map = new HashMap<>();
    map.put("id", id);

    // Is there a better way to convert my object list?
    List<Map<String, String>> convertedObjectList = new ArrayList<>();
    for(MyObject myObject : myObjectList){
      Map<String, String> convertedObject = new HashMap<>();
      convertedObject.put("name", myObject.getName());
      convertedObject.put("value", myObject.getValue());
      convertedObjectList.add(convertedObject);
    }

    map.put("myObjectList", convertedObjectList);

    return map;
  }
}

As you can see in comments: is there a better way the list of myObject? I tried to put directly the object list in the map.put but it indexes the toString() method result.

Thank you :)

Error

I am trying to use this but it gives the following error while I run the example

sbt.ResolveException: unresolved dependency: com.clever-age#play2-elasticsearch;2.1-SNAPSHOT: not found
and hence the compilation fails for references of import com.github.cleverage.elasticsearch.IndexResults;

Also i tried using "com.clever-age" % "play2-elasticsearch" % "0.8.1"

But hits the error : sbt.ResolveException: unresolved dependency: com.typesafe.play#play-server_2.10;2.6.2: not found

Any pointers will be appreciated

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.