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
SELECT * FROM mv_daily_sales_summary | |
WHERE seller_id = 'seller_123' | |
AND sale_date = '2024-01-30'; |
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
INSERT INTO | |
mv_daily_sales_summary | |
SELECT | |
o.tenant_id AS seller_id, | |
p.product_category, | |
o.order_date AS sale_date, | |
COUNT(*) AS total_orders, | |
SUM(o.total_amount) AS total_sales | |
FROM | |
orders o |
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
PUT /movies/_mapping | |
{ | |
"properties": { | |
"category": { | |
"type": "keyword" | |
} | |
} | |
} |
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
from elasticsearch import Elasticsearch | |
# Connect to your Elasticsearch instance | |
es = Elasticsearch([{'host': 'localhost', 'port': 9200}]) | |
# Index name and document ID for the example | |
index_name = 'your_index' | |
document_id = 'your_document_id' | |
# Specify the nested field and the updated value |
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
from elasticsearch import Elasticsearch | |
# Connect to your Elasticsearch instance | |
es = Elasticsearch([{'host': 'localhost', 'port': 9200}]) | |
# Index name and document ID you want to update | |
index_name = 'movies' | |
document_id = 'your_document_id' | |
# Define the Painless script for the update |
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
from elasticsearch import Elasticsearch | |
# Connect to Elasticsearch | |
es = Elasticsearch([{'host': 'localhost', 'port': 9200}]) | |
# Index name and document ID | |
index_name = "your_index" | |
document_id = "1" | |
# Specify the fields to be updated |
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
from elasticsearch import Elasticsearch | |
# Connect to Elasticsearch | |
es = Elasticsearch([{'host': 'localhost', 'port': 9200}]) | |
# Index name and document ID | |
index_name = "your_index" | |
document_id = "1" | |
# Retrieve the existing document |
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
- | |
from elasticsearch import Elasticsearch | |
# Connect to your Elasticsearch instance | |
es = Elasticsearch([{'host': 'localhost', 'port': 9200}]) | |
# Index name and document ID you want to update | |
index_name = 'movies' | |
document_id = 'your_document_id' |
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
{ | |
"name": "House of Cards", | |
"description": "Frank Underwood is a Democrat appointed as the Secretary of State. Along with his wife, he sets out on a quest to seek revenge from the people who betrayed him while successfully rising to supremacy.", | |
"genres": ["drama", "thriller"], | |
"views": 100, | |
} |
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
SELECT p.title, p.content, c.text | |
FROM posts p | |
JOIN comments c ON p.post_id = c.post_id | |
WHERE p.post_id = 1; |
NewerOlder