Skip to content

Commit d315ae3

Browse files
committed
Override Duration data type
1 parent 61b5ecc commit d315ae3

File tree

3 files changed

+336
-20
lines changed

3 files changed

+336
-20
lines changed

docs/examples/languageExamples.json

Lines changed: 164 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3016,23 +3016,23 @@
30163016
"specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml": [
30173017
{
30183018
"language": "Python",
3019-
"code": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ],\n)"
3019+
"code": "resp = client.indices.put_alias(\n index=\"my-index-2099.05.06-000001\",\n name=\"my-alias\",\n filter={\n \"bool\": {\n \"filter\": [\n {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"now-1d/d\",\n \"lt\": \"now/d\"\n }\n }\n },\n {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n ]\n }\n },\n)"
30203020
},
30213021
{
30223022
"language": "JavaScript",
3023-
"code": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"my-data-stream\",\n alias: \"my-alias\",\n },\n },\n ],\n});"
3023+
"code": "const response = await client.indices.putAlias({\n index: \"my-index-2099.05.06-000001\",\n name: \"my-alias\",\n filter: {\n bool: {\n filter: [\n {\n range: {\n \"@timestamp\": {\n gte: \"now-1d/d\",\n lt: \"now/d\",\n },\n },\n },\n {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n ],\n },\n },\n});"
30243024
},
30253025
{
30263026
"language": "Ruby",
3027-
"code": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n }\n)"
3027+
"code": "response = client.indices.put_alias(\n index: \"my-index-2099.05.06-000001\",\n name: \"my-alias\",\n body: {\n \"filter\": {\n \"bool\": {\n \"filter\": [\n {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"now-1d/d\",\n \"lt\": \"now/d\"\n }\n }\n },\n {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n ]\n }\n }\n }\n)"
30283028
},
30293029
{
30303030
"language": "PHP",
3031-
"code": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"my-data-stream\",\n \"alias\" => \"my-alias\",\n ],\n ],\n ),\n ],\n]);"
3031+
"code": "$resp = $client->indices()->putAlias([\n \"index\" => \"my-index-2099.05.06-000001\",\n \"name\" => \"my-alias\",\n \"body\" => [\n \"filter\" => [\n \"bool\" => [\n \"filter\" => array(\n [\n \"range\" => [\n \"@timestamp\" => [\n \"gte\" => \"now-1d/d\",\n \"lt\" => \"now/d\",\n ],\n ],\n ],\n [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ),\n ],\n ],\n ],\n]);"
30323032
},
30333033
{
30343034
"language": "curl",
3035-
"code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"my-data-stream\",\"alias\":\"my-alias\"}}]}' \"$ELASTICSEARCH_URL/_aliases\""
3035+
"code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"filter\":{\"bool\":{\"filter\":[{\"range\":{\"@timestamp\":{\"gte\":\"now-1d/d\",\"lt\":\"now/d\"}}},{\"term\":{\"user.id\":\"kimchy\"}}]}}}' \"$ELASTICSEARCH_URL/my-index-2099.05.06-000001/_alias/my-alias\""
30363036
}
30373037
],
30383038
"specification/indices/put_data_stream_settings/examples/request/IndicesPutDataStreamSettingsRequestExample1.yaml": [
@@ -11552,23 +11552,23 @@
1155211552
"specification/inference/text_embedding/examples/request/TextEmbeddingRequestExample1.yaml": [
1155311553
{
1155411554
"language": "Python",
11555-
"code": "resp = client.inference.text_embedding(\n inference_id=\"my-cohere-endpoint\",\n input=\"The sky above the port was the color of television tuned to a dead channel.\",\n task_settings={\n \"input_type\": \"ingest\"\n },\n)"
11555+
"code": "resp = client.inference.text_embedding(\n inference_id=\"my-cohere-endpoint\",\n input=\"The sky above the port was the color of television tuned to a dead channel.\",\n input_type=\"ingest\",\n)"
1155611556
},
1155711557
{
1155811558
"language": "JavaScript",
11559-
"code": "const response = await client.inference.textEmbedding({\n inference_id: \"my-cohere-endpoint\",\n input:\n \"The sky above the port was the color of television tuned to a dead channel.\",\n task_settings: {\n input_type: \"ingest\",\n },\n});"
11559+
"code": "const response = await client.inference.textEmbedding({\n inference_id: \"my-cohere-endpoint\",\n input:\n \"The sky above the port was the color of television tuned to a dead channel.\",\n input_type: \"ingest\",\n});"
1156011560
},
1156111561
{
1156211562
"language": "Ruby",
11563-
"code": "response = client.inference.text_embedding(\n inference_id: \"my-cohere-endpoint\",\n body: {\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\",\n \"task_settings\": {\n \"input_type\": \"ingest\"\n }\n }\n)"
11563+
"code": "response = client.inference.text_embedding(\n inference_id: \"my-cohere-endpoint\",\n body: {\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\",\n \"input_type\": \"ingest\"\n }\n)"
1156411564
},
1156511565
{
1156611566
"language": "PHP",
11567-
"code": "$resp = $client->inference()->textEmbedding([\n \"inference_id\" => \"my-cohere-endpoint\",\n \"body\" => [\n \"input\" => \"The sky above the port was the color of television tuned to a dead channel.\",\n \"task_settings\" => [\n \"input_type\" => \"ingest\",\n ],\n ],\n]);"
11567+
"code": "$resp = $client->inference()->textEmbedding([\n \"inference_id\" => \"my-cohere-endpoint\",\n \"body\" => [\n \"input\" => \"The sky above the port was the color of television tuned to a dead channel.\",\n \"input_type\" => \"ingest\",\n ],\n]);"
1156811568
},
1156911569
{
1157011570
"language": "curl",
11571-
"code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"The sky above the port was the color of television tuned to a dead channel.\",\"task_settings\":{\"input_type\":\"ingest\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/my-cohere-endpoint\""
11571+
"code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"The sky above the port was the color of television tuned to a dead channel.\",\"input_type\":\"ingest\"}' \"$ELASTICSEARCH_URL/_inference/text_embedding/my-cohere-endpoint\""
1157211572
}
1157311573
],
1157411574
"specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample1.yaml": [
@@ -14848,5 +14848,159 @@
1484814848
"language": "curl",
1484914849
"code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"}' \"$ELASTICSEARCH_URL/_sql?format=txt\""
1485014850
}
14851+
],
14852+
"specification/indices/put_alias/examples/request/indicesPutAliasRequestExample3.yaml": [
14853+
{
14854+
"language": "Python",
14855+
"code": "resp = client.indices.put_alias(\n index=\"my-index-2099.05.06-000001\",\n name=\"my-alias\",\n routing=\"1\",\n)"
14856+
},
14857+
{
14858+
"language": "JavaScript",
14859+
"code": "const response = await client.indices.putAlias({\n index: \"my-index-2099.05.06-000001\",\n name: \"my-alias\",\n routing: 1,\n});"
14860+
},
14861+
{
14862+
"language": "Ruby",
14863+
"code": "response = client.indices.put_alias(\n index: \"my-index-2099.05.06-000001\",\n name: \"my-alias\",\n body: {\n \"routing\": \"1\"\n }\n)"
14864+
},
14865+
{
14866+
"language": "PHP",
14867+
"code": "$resp = $client->indices()->putAlias([\n \"index\" => \"my-index-2099.05.06-000001\",\n \"name\" => \"my-alias\",\n \"body\" => [\n \"routing\" => \"1\",\n ],\n]);"
14868+
},
14869+
{
14870+
"language": "curl",
14871+
"code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"routing\":\"1\"}' \"$ELASTICSEARCH_URL/my-index-2099.05.06-000001/_alias/my-alias\""
14872+
}
14873+
],
14874+
"specification/indices/put_alias/examples/request/indicesPutAliasRequestExample2.yaml": [
14875+
{
14876+
"language": "Python",
14877+
"code": "resp = client.indices.put_alias(\n index=\"logs-my_app-default\",\n name=\"logs\",\n is_write_index=True,\n)"
14878+
},
14879+
{
14880+
"language": "JavaScript",
14881+
"code": "const response = await client.indices.putAlias({\n index: \"logs-my_app-default\",\n name: \"logs\",\n is_write_index: true,\n});"
14882+
},
14883+
{
14884+
"language": "Ruby",
14885+
"code": "response = client.indices.put_alias(\n index: \"logs-my_app-default\",\n name: \"logs\",\n body: {\n \"is_write_index\": true\n }\n)"
14886+
},
14887+
{
14888+
"language": "PHP",
14889+
"code": "$resp = $client->indices()->putAlias([\n \"index\" => \"logs-my_app-default\",\n \"name\" => \"logs\",\n \"body\" => [\n \"is_write_index\" => true,\n ],\n]);"
14890+
},
14891+
{
14892+
"language": "curl",
14893+
"code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"is_write_index\":true}' \"$ELASTICSEARCH_URL/logs-my_app-default/_alias/logs\""
14894+
}
14895+
],
14896+
"specification/streams/logs_disable/examples/request/PostStreamsDisableRequestExample1.yaml": [
14897+
{
14898+
"language": "Python",
14899+
"code": "resp = client.streams.logs_disable()"
14900+
},
14901+
{
14902+
"language": "JavaScript",
14903+
"code": "const response = await client.streams.logsDisable();"
14904+
},
14905+
{
14906+
"language": "Ruby",
14907+
"code": "response = client.streams.logs_disable"
14908+
},
14909+
{
14910+
"language": "PHP",
14911+
"code": "$resp = $client->streams()->logsDisable();"
14912+
},
14913+
{
14914+
"language": "curl",
14915+
"code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_streams/logs/_disable\""
14916+
}
14917+
],
14918+
"specification/streams/status/examples/request/GetStreamsStatusRequestExample1.yaml": [
14919+
{
14920+
"language": "Python",
14921+
"code": "resp = client.streams.status()"
14922+
},
14923+
{
14924+
"language": "JavaScript",
14925+
"code": "const response = await client.streams.status();"
14926+
},
14927+
{
14928+
"language": "Ruby",
14929+
"code": "response = client.streams.status"
14930+
},
14931+
{
14932+
"language": "PHP",
14933+
"code": "$resp = $client->streams()->status();"
14934+
},
14935+
{
14936+
"language": "curl",
14937+
"code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_streams/status\""
14938+
}
14939+
],
14940+
"specification/streams/logs_enable/examples/request/PostStreamsEnableRequestExample1.yaml": [
14941+
{
14942+
"language": "Python",
14943+
"code": "resp = client.streams.logs_enable()"
14944+
},
14945+
{
14946+
"language": "JavaScript",
14947+
"code": "const response = await client.streams.logsEnable();"
14948+
},
14949+
{
14950+
"language": "Ruby",
14951+
"code": "response = client.streams.logs_enable"
14952+
},
14953+
{
14954+
"language": "PHP",
14955+
"code": "$resp = $client->streams()->logsEnable();"
14956+
},
14957+
{
14958+
"language": "curl",
14959+
"code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_streams/logs/_enable\""
14960+
}
14961+
],
14962+
"specification/project/tags/examples/request/ProjectTagsRequestExample1.yaml": [
14963+
{
14964+
"language": "Python",
14965+
"code": "resp = client.project.tags()"
14966+
},
14967+
{
14968+
"language": "JavaScript",
14969+
"code": "const response = await client.project.tags();"
14970+
},
14971+
{
14972+
"language": "Ruby",
14973+
"code": "response = client.project.tags"
14974+
},
14975+
{
14976+
"language": "PHP",
14977+
"code": "$resp = $client->project()->tags();"
14978+
},
14979+
{
14980+
"language": "curl",
14981+
"code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_project/tags\""
14982+
}
14983+
],
14984+
"specification/inference/put_contextualai/examples/request/PutContextualAiRequestExample1.yaml": [
14985+
{
14986+
"language": "Python",
14987+
"code": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"contextualai-rerank\",\n inference_config={\n \"service\": \"contextualai\",\n \"service_settings\": {\n \"api_key\": \"ContextualAI-Api-key\",\n \"model_id\": \"ctxl-rerank-v2-instruct-multilingual-mini\"\n },\n \"task_settings\": {\n \"instruction\": \"Rerank the following documents based on their relevance to the query.\",\n \"top_k\": 3\n }\n },\n)"
14988+
},
14989+
{
14990+
"language": "JavaScript",
14991+
"code": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"contextualai-rerank\",\n inference_config: {\n service: \"contextualai\",\n service_settings: {\n api_key: \"ContextualAI-Api-key\",\n model_id: \"ctxl-rerank-v2-instruct-multilingual-mini\",\n },\n task_settings: {\n instruction:\n \"Rerank the following documents based on their relevance to the query.\",\n top_k: 3,\n },\n },\n});"
14992+
},
14993+
{
14994+
"language": "Ruby",
14995+
"code": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"contextualai-rerank\",\n body: {\n \"service\": \"contextualai\",\n \"service_settings\": {\n \"api_key\": \"ContextualAI-Api-key\",\n \"model_id\": \"ctxl-rerank-v2-instruct-multilingual-mini\"\n },\n \"task_settings\": {\n \"instruction\": \"Rerank the following documents based on their relevance to the query.\",\n \"top_k\": 3\n }\n }\n)"
14996+
},
14997+
{
14998+
"language": "PHP",
14999+
"code": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"contextualai-rerank\",\n \"body\" => [\n \"service\" => \"contextualai\",\n \"service_settings\" => [\n \"api_key\" => \"ContextualAI-Api-key\",\n \"model_id\" => \"ctxl-rerank-v2-instruct-multilingual-mini\",\n ],\n \"task_settings\" => [\n \"instruction\" => \"Rerank the following documents based on their relevance to the query.\",\n \"top_k\" => 3,\n ],\n ],\n]);"
15000+
},
15001+
{
15002+
"language": "curl",
15003+
"code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"contextualai\",\"service_settings\":{\"api_key\":\"ContextualAI-Api-key\",\"model_id\":\"ctxl-rerank-v2-instruct-multilingual-mini\"},\"task_settings\":{\"instruction\":\"Rerank the following documents based on their relevance to the query.\",\"top_k\":3}}' \"$ELASTICSEARCH_URL/_inference/rerank/contextualai-rerank\""
15004+
}
1485115005
]
1485215006
}

docs/overlays/elasticsearch-shared-overlays.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,3 +1152,11 @@ actions:
11521152
- target: "$.components['schemas']['cat._types.CatTransformColumn'].enum"
11531153
description: Remove enum array from cat transforms
11541154
remove: true
1155+
# Simplify duration type
1156+
- target: "$.components['schemas']['_types.Duration'].oneOf"
1157+
description: Remove existing oneOf definition for Duration
1158+
remove: true
1159+
- target: "$.components['schemas']['_types.Duration']"
1160+
description: Re-add a simple string type for Duration
1161+
update:
1162+
type: string

0 commit comments

Comments
 (0)