Method: Elasticsearch::API::Indices::Actions#get_field_mapping
- Defined in:
- lib/elasticsearch/api/actions/indices/get_field_mapping.rb
#get_field_mapping(arguments = {}) ⇒ Object
Get mapping definitions. Retrieves mapping definitions for one or more fields. For data streams, the API retrieves field mappings for the stream’s backing indices. This API is useful if you don’t need a complete mapping or if an index mapping contains a large number of fields.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/elasticsearch/api/actions/indices/get_field_mapping.rb', line 57 def get_field_mapping(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.get_field_mapping' } defined_params = [:fields, :index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) end request_opts[:defined_params] = defined_params unless defined_params.empty? raise ArgumentError, "Required argument 'fields' missing" unless arguments[:fields] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _fields = arguments.delete(:fields) _index = arguments.delete(:index) method = Elasticsearch::API::HTTP_GET path = if _index && _fields "#{Utils.listify(_index)}/_mapping/field/#{Utils.listify(_fields)}" else "_mapping/field/#{Utils.listify(_fields)}" end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |