[Task Manager] Remove doc type awareness (#28968)

* remove doc from mappings

* fix: section for type should include an inner object describing the mapping
This commit is contained in:
Tim Sullivan 2019-01-28 10:20:31 -07:00 committed by GitHub
parent 8b66711501
commit 97dc19c608
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 22 deletions

View file

@ -296,11 +296,13 @@ The task manager's public API is create / delete / list. Updates aren't directly
## Testing
- `node scripts/jest --testPathPattern=task_manager --watch`
Integration tests can be run like so:
```
node scripts/functional_tests_server.js --config test/plugin_functional/config.js
node scripts/functional_test_runner --config test/plugin_functional/config.js --grep task_manager
```
- Unit tests:
```
cd x-pack
node scripts/jest --testPathPattern=task_manager --watch
```
- Integration tests:
```
node scripts/functional_tests_server.js --config x-pack/test/plugin_api_integration/config.js
node scripts/functional_test_runner --config x-pack/test/plugin_api_integration/config.js
```

View file

@ -70,7 +70,6 @@ describe('TaskStore', () => {
expect(arg).toMatchObject({
index: 'tasky',
type: '_doc',
body: {
task: {
params: JSON.stringify(task.params),
@ -138,7 +137,6 @@ describe('TaskStore', () => {
test('empty call filters by type, sorts by runAt and id', async () => {
const { args } = await testFetch();
expect(args).toMatchObject({
type: '_doc',
index: 'tasky',
body: {
sort: [{ 'task.runAt': 'asc' }, { _id: 'desc' }],
@ -350,7 +348,6 @@ describe('TaskStore', () => {
version: true,
},
index,
type: '_doc',
});
});
@ -457,7 +454,6 @@ describe('TaskStore', () => {
expect(callCluster.args[0][1]).toMatchObject({
id: task.id,
index: 'tasky',
type: '_doc',
version: 2,
refresh: true,
body: {
@ -507,7 +503,6 @@ describe('TaskStore', () => {
expect(callCluster.args[0][1]).toMatchObject({
id,
index: 'myindex',
type: '_doc',
refresh: true,
});
});

View file

@ -41,7 +41,6 @@ export interface RemoveResult {
export interface RawTaskDoc {
_id: string;
_index: string;
_type: string;
_version: number;
_source: {
type: string;
@ -126,7 +125,7 @@ export class TaskStore {
body: {
index_patterns: [this.index],
mappings: {
_doc: {
[DOC_TYPE]: {
dynamic: 'strict',
properties,
},
@ -173,7 +172,6 @@ export class TaskStore {
id,
body,
index: this.index,
type: DOC_TYPE,
refresh: true,
});
@ -249,7 +247,6 @@ export class TaskStore {
},
id: doc.id,
index: this.index,
type: DOC_TYPE,
version: doc.version,
// The refresh is important so that if we immediately look for work,
// we don't pick up this task.
@ -272,7 +269,6 @@ export class TaskStore {
const result = await this.callCluster('delete', {
id,
index: this.index,
type: DOC_TYPE,
// The refresh is important so that if we immediately look for work,
// we don't pick up this task.
refresh: true,
@ -294,7 +290,6 @@ export class TaskStore {
: queryOnlyTasks;
const result = await this.callCluster('search', {
type: DOC_TYPE,
index: this.index,
ignoreUnavailable: true,
body: {
@ -355,7 +350,6 @@ function taskDocToRaw(doc: ConcreteTaskInstance, index: string): RawTaskDoc {
_id: doc.id,
_index: index,
_source: { type, task },
_type: DOC_TYPE,
_version: doc.version,
};
}

View file

@ -43,7 +43,6 @@ export default function (kibana) {
const callCluster = kbnServer.server.plugins.elasticsearch.getCluster('admin').callWithInternalUser;
await callCluster('index', {
index: '.task_manager_test_result',
type: '_doc',
body: {
type: 'task',
taskId: taskInstance.id,

View file

@ -37,7 +37,6 @@ export default function ({ getService }) {
function historyDocs() {
return es.search({
index: testHistoryIndex,
type: '_doc',
q: 'type:task',
}).then(result => result.hits.hits);
}