Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Result Models and Add List fetching functionality to ElasticRe…
…stClient
- Loading branch information
1 parent
e135f90
commit 38f70bf
Showing
10 changed files
with
188 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/com/rimonmostafiz/elasticlight/component/EsParameterizedType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.rimonmostafiz.elasticlight.component; | ||
|
||
import java.lang.reflect.ParameterizedType; | ||
import java.lang.reflect.Type; | ||
|
||
/** | ||
* @author Rimon Mostafiz | ||
*/ | ||
public class EsParameterizedType implements ParameterizedType { | ||
private final ParameterizedType parameterizedType; | ||
private final Type[] actualTypes; | ||
|
||
public EsParameterizedType(ParameterizedType parameterizedType, Type[] actualTypes) { | ||
this.parameterizedType = parameterizedType; | ||
this.actualTypes = actualTypes; | ||
} | ||
|
||
@Override | ||
public Type[] getActualTypeArguments() { | ||
return actualTypes; | ||
} | ||
|
||
@Override | ||
public Type getRawType() { | ||
return parameterizedType.getRawType(); | ||
} | ||
|
||
@Override | ||
public Type getOwnerType() { | ||
return parameterizedType.getOwnerType(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/com/rimonmostafiz/elasticlight/model/result/EsHit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.rimonmostafiz.elasticlight.model.result; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* @author Rimon Mostafiz | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class EsHit<T> { | ||
|
||
@JsonProperty("_index") | ||
private String index; | ||
|
||
@JsonProperty("_type") | ||
private String type; | ||
|
||
@JsonProperty("_source") | ||
private T source; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/rimonmostafiz/elasticlight/model/result/Hits.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.rimonmostafiz.elasticlight.model.result; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Rimon Mostafiz | ||
*/ | ||
@Data | ||
@ToString | ||
@NoArgsConstructor | ||
public class Hits<T> { | ||
@JsonProperty("hits") | ||
private List<EsHit<T>> esHits; | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/rimonmostafiz/elasticlight/model/result/SearchResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.rimonmostafiz.elasticlight.model.result; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* @author Rimon Mostafiz | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class SearchResult<T> { | ||
@JsonProperty("_shards") | ||
private Shards shards; | ||
private Hits<T> hits; | ||
private Integer took; | ||
@JsonProperty("timed_out") | ||
private boolean timedOut; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/rimonmostafiz/elasticlight/model/result/Shards.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.rimonmostafiz.elasticlight.model.result; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* @author Rimon Mostafiz | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Shards { | ||
private Integer total; | ||
private Integer failed; | ||
private Integer successful; | ||
private Integer skipped; | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/rimonmostafiz/elasticlight/model/result/Source.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.rimonmostafiz.elasticlight.model.result; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
|
||
/** | ||
* @author Rimon Mostafiz | ||
*/ | ||
@Data | ||
@ToString | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Source<T> { | ||
T obj; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters