Skip to content
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

Add FieldCapabilities (_field_caps) API #23007

Merged
merged 4 commits into from
Mar 31, 2017
Merged

Add FieldCapabilities (_field_caps) API #23007

merged 4 commits into from
Mar 31, 2017

Commits on Mar 28, 2017

  1. Add FieldCapabilities (_field_caps) API

    This change introduces a new API called `_field_caps` that allows to retrieve the capabilities of specific fields.
    This field centric API relies solely on the mapping of the requested indices to extract the following infos:
    * `types`: one or many field types if the type is not the same across the requested indices
    * `searchable`: Whether this field is indexed for search on at least one requested indices.
    * `aggregatable`:  Whether this field can be aggregated on at least one requested indices.
    
    Example:
    
    ````
    GET t,v/_field_caps?fields=field1,field2,field3
    ````
    
    returns:
    
    ````
    {
       "fields": {
          "field1": {
             "_all": {
                "types": "text",
                "searchable": true,
                "aggregatable": false
             }
          },
          "field3": {
             "_all": {
                "types": "text",
                "searchable": true,
                "aggregatable": false
             }
          },
          "field2": {
             "_all": {
                "types": [
                   "keyword",
                   "long"
                ],
                "searchable": true,
                "aggregatable": true
             }
          }
       }
    }
    ````
    
    In this example `field1` and `field3` have the same type `text` across the requested indices `t` and `v`.
    Conversely `field2` is defined with two conflicting types `keyword` and `long`.
    Note that `_field_caps` does not treat this case as an error but rather return the list of unique types seen for this field.
    
    It is also possible to get a view of each index field capabilities with the `level` parameter:
    
    ````
    GET t,v/_field_caps?fields=field2&level=indices
    ````
    
    ````
    {
       "fields": {
          "field2": {
             "t": {
                "types": "keyword",
                "searchable": true,
                "aggregatable": true
             },
             "v": {
                "types": "long",
                "searchable": true,
                "aggregatable": true
             }
          }
       }
    }
    ````
    jimczi committed Mar 28, 2017
    Configuration menu
    Copy the full SHA
    8001480 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    19e8803 View commit details
    Browse the repository at this point in the history

Commits on Mar 29, 2017

  1. Add hanlder for POST request

    jimczi committed Mar 29, 2017
    Configuration menu
    Copy the full SHA
    8c62e10 View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2017

  1. after review

    jimczi committed Mar 31, 2017
    Configuration menu
    Copy the full SHA
    1c1c026 View commit details
    Browse the repository at this point in the history