This file contains hidden or 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
| // POST http://localhost:9200/index_name/_search | |
| { | |
| "size": 100, | |
| "query": { | |
| "bool": { | |
| ... | |
| } | |
| }, | |
| "pit": { | |
| "id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==", |
This file contains hidden or 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
| curl --request POST 'http://localhost:9200/index_name/_pit' \ | |
| --header 'Content-Type: application/json' \ | |
| --data-raw '{ | |
| "id" : "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==" | |
| }' |
This file contains hidden or 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
| curl --request POST 'http://localhost:9200/index_name/_pit?keep_alive=10m' |
This file contains hidden or 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
| // POST http://localhost:9200/index_name/_search | |
| { | |
| "size": 100, | |
| "query": { | |
| "bool": { | |
| ... | |
| } | |
| }, | |
| "sort": [ | |
| { |
This file contains hidden or 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
| { | |
| ..., | |
| "sort": [123432415, "b6bcaa43-49aa-47be-8d4d-8f886db0c49b"] | |
| } |
This file contains hidden or 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
| // POST http://localhost:9200/index_name/_search | |
| { | |
| "size": 100, | |
| "query": { | |
| "bool": { | |
| ... | |
| } | |
| }, | |
| "sort": [{ | |
| "businessFieldForSorting": { |
This file contains hidden or 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
| import org.json.JSONObject; | |
| import io.searchbox.client.JestClient; | |
| import org.springframework.data.domain.Sort; | |
| import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; | |
| import org.springframework.data.elasticsearch.core.EntityMapper; | |
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import io.searchbox.core.SearchResult; | |
| ... |
This file contains hidden or 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
| public void searchDocumentsWithSearchAfter() { | |
| String businessSortMarker = null; | |
| String tiebreakerSortMarker = null; | |
| while (true) { | |
| var page = searchAfter("businessFieldForSorting", "DESC", businessSortMarker, tiebreakerSortMarker); | |
| var content = page.getContent(); | |
| if (content.isEmpty()) { |
This file contains hidden or 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
| import org.springframework.data.elasticsearch.core.ScrolledPage; | |
| import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; | |
| ... | |
| @Autowired | |
| private JestElasticsearchTemplate jestTemplate; | |
| //how long Elasticsearch should retain the search context for the request | |
| private static final int SCROLL_TIMEOUT = 100; |
This file contains hidden or 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
| import org.springframework.data.domain.Sort; | |
| import org.springframework.data.domain.Page; | |
| import org.springframework.data.domain.PageRequest; | |
| import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; | |
| import org.elasticsearch.index.query.BoolQueryBuilder; | |
| import com.github.vanroy.springdata.jest.JestElasticsearchTemplate; | |
| ... |
NewerOlder