Last active
March 14, 2025 20:02
-
-
Save joeywhelan/82ff40d840e24c78e5c37c1df62410ae to your computer and use it in GitHub Desktop.
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
| from elasticsearch import Elasticsearch | |
| WEST_IP = "172.18.0.4" | |
| client = Elasticsearch(f"https://{WEST_IP}:9200", ca_certs="../../west/west-http-ca.crt", basic_auth=("elastic", "elastic")) | |
| resp = client.search(index=["west_ccs", "east_remote:east_ccs"], query={"range": {"release_date": {"gte": 1985}}}) | |
| for hit in resp["hits"]["hits"]: | |
| print(hit["_source"]) |
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
| { "index" : { "_index" : "east_ccs" } } | |
| {"name": "Brave New World", "author": "Aldous Huxley", "release_date": "1932-06-01", "page_count": 268} | |
| { "index" : { "_index" : "east_ccs" } } | |
| {"name": "The Handmaid'"'"'s Tale", "author": "Margaret Atwood", "release_date": "1985-06-01", "page_count": 311} |
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
| { "index" : { "_index" : "west_ccs" } } | |
| {"name": "1984", "author": "George Orwell", "release_date": "1985-06-01", "page_count": 328} | |
| { "index" : { "_index" : "west_ccs" } } | |
| {"name": "Fahrenheit 451", "author": "Ray Bradbury", "release_date": "1953-10-15", "page_count": 227} |
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
| $ python3 ccs_test.py | |
| {'name': "The Handmaid's Tale", 'author': 'Margaret Atwood', 'release_date': '1985-06-01', 'page_count': 311} | |
| {'name': '1984', 'author': 'George Orwell', 'release_date': '1985-06-01', 'page_count': 328} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment