kibana/test/unit/api/ingest/index.js
Elastic Jasper 1c53b0df04 Backport PR #8421
---------

**Commit 1:**
Add field_capabilities API

This adds a simple API for getting the searchable/aggregatable status of
a list of fields in a given index, list of indices, or index pattern. In
the future this will probably evolve into a full blown fields info API
that we can use when removing the index pattern mapping cache. For now
though it's built to provide the minimum info needed to fix
https://github.com/elastic/kibana/issues/6769

Usage:

The API exposes a single GET endpoint.

```
GET /api/kibana/{indices}/field_capabilities
```

`indices` can be a single index, a comma delimited list, or a wildcard
pattern

Example response:

```
{
  "fields": {
    "imsearchable": {
      "searchable": true,
      "aggregatable": false
    },
    "imaggregatable": {
      "searchable": true,
      "aggregatable": true
    },
  }
}
```

* Original sha: 1af6b76bd4
* Authored by Matthew Bargar <mbargar@gmail.com> on 2016-09-21T18:38:34Z

**Commit 2:**
Filter non-aggregatable fields from vis editor UI

Using the field_capabilities API added in the previous commit, this commit enhances
the client side index pattern object with information about the
searchable and aggregatable status of each field in the index pattern.
We then use this information to filter out non-aggregatable fields from
the vis editor so that users won't accidentally select them and get
nasty errors. An example of a non-aggregatable field would be a `text`
field without fielddata enabled (which is the default).

I also added the searchable and aggregatable flags to the index pattern
page so users can see the status of their fields. I removed the `indexed`
column because it was mostly redundant with `searchable` and I needed
the horizontal space.

The addition of the searchable and aggregatable properties for index
pattern fields would require users to manually refresh their field list
when upgrading to 5.0. This commit also adds a check for those properties and
if they're missing it automatically refreshes the field list for the
user in a seamless manner.

* Original sha: 4a906f30c7
* Authored by Matthew Bargar <mbargar@gmail.com> on 2016-09-21T19:18:10Z
2016-09-23 12:21:40 -04:00

37 lines
1.4 KiB
JavaScript

define(function (require) {
var bdd = require('intern!bdd');
var serverConfig = require('intern/dojo/node!../../../server_config');
var ScenarioManager = require('intern/dojo/node!../../../fixtures/scenario_manager');
var request = require('intern/dojo/node!supertest-as-promised');
var url = require('intern/dojo/node!url');
var _ = require('intern/dojo/node!lodash');
var expect = require('intern/dojo/node!expect.js');
var post = require('./_post');
var del = require('./_del');
var data = require('./_data');
var simulate = require('./_simulate');
var processors = require('./_processors');
var processorTypes = require('./processors/index');
var fieldCapabilities = require('./_field_capabilities');
bdd.describe('ingest API', function () {
var scenarioManager = new ScenarioManager(url.format(serverConfig.servers.elasticsearch));
request = request(url.format(serverConfig.servers.kibana) + '/api');
bdd.before(function () {
return scenarioManager.load('emptyKibana');
});
bdd.after(function () {
return scenarioManager.unload('emptyKibana');
});
post(bdd, scenarioManager, request);
del(bdd, scenarioManager, request);
data(bdd, scenarioManager, request);
simulate(bdd, scenarioManager, request);
processors(bdd, scenarioManager, request);
processorTypes(bdd, scenarioManager, request);
fieldCapabilities(bdd, scenarioManager, request);
});
});