Hi, I am basically a java developer and just started learning elasticsearch. I have a requirement as below.
I have a Customer and Address models in Java. Let's assume one Customer having 1000 addresses. If we get all addresses at a time it will degrade the performance, So while getting customer based on customerId should get only 100 addresses per page. Initially we should get first 100 addresses and If user send request for page2 then should get 101-200 addresses and so on .
Java Code:
public class Customer {
String customerId;
List<Address> addresses;
}
public class Address {
String id;
String zip;
}
Query to get all Addresses:
GET /test/_search
{
"query": {
"bool": {
"must": [
{
"bool": {
"must": [
{
"terms": {
"customerId": [
"AbCdEFgeFHhafaea"
],
"boost": 1
}
}
]
}
}
]
}
}
}
Can someone please help me with modified query for above mentioned criteria ?