mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-28 12:43:39 +08:00

* elasticsearch: bump handled version to 6.0 After 4de0e5659d451baee65af412242b95f174444d87 * elasticsearch: tests against elasticsearch 8
38 lines
966 B
Python
38 lines
966 B
Python
from elasticsearch_dsl import ( # pylint: disable=unused-import
|
|
Document,
|
|
Keyword,
|
|
Text,
|
|
)
|
|
|
|
|
|
class Article(Document):
|
|
title = Text(analyzer="snowball", fields={"raw": Keyword()})
|
|
body = Text(analyzer="snowball")
|
|
|
|
class Index:
|
|
name = "test-index"
|
|
|
|
|
|
dsl_create_statement = {
|
|
"mappings": {
|
|
"properties": {
|
|
"title": {
|
|
"analyzer": "snowball",
|
|
"fields": {"raw": {"type": "keyword"}},
|
|
"type": "text",
|
|
},
|
|
"body": {"analyzer": "snowball", "type": "text"},
|
|
}
|
|
}
|
|
}
|
|
dsl_index_result = (1, {}, '{"result": "created"}')
|
|
dsl_index_span_name = "Elasticsearch/test-index/_doc/:id"
|
|
dsl_index_url = "/test-index/_doc/2"
|
|
dsl_search_method = "POST"
|
|
|
|
perform_request_mock_path = "elasticsearch.connection.http_urllib3.Urllib3HttpConnection.perform_request"
|
|
|
|
|
|
def mock_response(body: str, status_code: int = 200):
|
|
return (status_code, {}, body)
|