-
Notifications
You must be signed in to change notification settings - Fork 106
Adding specification for the new data stream mappings API #4751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Following you can find the validation changes against the target branch for the APIs.
You can validate these APIs yourself by using the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API themselves look great, thank you! I do have questions about examples, but am not sure of the answers.
alternatives: | ||
- language: Python | ||
code: |- | ||
resp = client.indices.get_data_stream_mappings( | ||
name="my-data-stream", | ||
) | ||
- language: JavaScript | ||
code: |- | ||
const response = await client.indices.getDataStreamSettings({ | ||
name: "my-data-stream", | ||
}); | ||
- language: Ruby | ||
code: |- | ||
response = client.indices.get_data_stream_mappings( | ||
name: "my-data-stream" | ||
) | ||
- language: PHP | ||
code: |- | ||
$resp = $client->indices()->getDataStreamSettings([ | ||
"name" => "my-data-stream", | ||
]); | ||
- language: curl | ||
code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_data_stream/my-data-stream/_mappings"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the alternatives are generated. However a summary (and description if needed) would help.
alternatives: | ||
- language: Python | ||
code: |- | ||
resp = client.indices.put_data_stream_mappings( | ||
name="my-data-stream", | ||
mappings={ | ||
"properties":{ | ||
"field1":{ | ||
"type":"ip" | ||
}, | ||
"field3":{ | ||
"type":"text" | ||
} | ||
} | ||
}, | ||
) | ||
- language: JavaScript | ||
code: |- | ||
const response = await client.indices.putDataStreamSettings({ | ||
name: "my-data-stream", | ||
mappings: { | ||
"properties":{ | ||
"field1":{ | ||
"type":"ip" | ||
}, | ||
"field3":{ | ||
"type":"text" | ||
} | ||
} | ||
}, | ||
}); | ||
- language: Ruby | ||
code: |- | ||
response = client.indices.put_data_stream_mappings( | ||
name: "my-data-stream", | ||
body: { | ||
"properties":{ | ||
"field1":{ | ||
"type":"ip" | ||
}, | ||
"field3":{ | ||
"type":"text" | ||
} | ||
} | ||
} | ||
) | ||
- language: PHP | ||
code: |- | ||
$resp = $client->indices()->putDataStreamSettings([ | ||
"name" => "my-data-stream", | ||
"body" => [ | ||
"properties" => [ | ||
"field1" => [ | ||
"type" => "ip" | ||
], | ||
"field3" => [ | ||
"type" => "text" | ||
] | ||
] | ||
], | ||
]); | ||
- language: curl | ||
code: | ||
'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d | ||
''{"index.lifecycle.name":"new-test-policy","index.number_of_shards":11}'' | ||
"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_mappings"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry that you took the time to do this, but it's generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I had wondered if that was the case, but didn't see a way to generate them.
# type: response | ||
# response_code: 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be uncommented. Not too familiar with examples to be honest. (I do appreciate that you worked on them!)
# type: response | |
# response_code: 200 | |
type: response | |
response_code: 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I copied all of these from the examples I had done for the simulate ingest API. Those also have this commented out. I probably need to fix those as well. (And I had probably copied those from somewhere else that also needs to be fixed.)
* is specified in the template that the data stream matches. The mapping change is only applied to new write indices | ||
* that are created during rollover after this API is called. No indices are changed by this API. | ||
* @rest_spec_name indices.put_data_stream_mappings | ||
* @availability stack stability=stable visibility=public |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume this is true here too:
* @availability stack stability=stable visibility=public | |
* @availability stack since=9.1.0 stability=stable visibility=public |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, 9.2.0. But I'll add that. Thanks.
/** | ||
* The mappings that are specfic to this data stream that will override any mappings from the matching index template. | ||
*/ | ||
mappings: TypeMapping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is mappings
optional? Validation fails because there's no mapping
field in this recording: https://github.com/elastic/clients-flight-recordings/blob/6b75a4d9630fe9d31fede2921e54e29f2944a34a/elasticsearch/indices.put_data_stream_mappings/088c21bc700471d61299699c6fe16612.json#L20-L25.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you are right. I'm not sure that was the wisest decision on my part, but it is optional. I've updated the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM.
This adds specifications for the new data stream mappings APIs.