Indexing of request_data, response_data disabled

In old style action logs we have mixing of
field types in the lists inside request_data and response_data.
Format of action_logs is already changed. So we should just
migrate old-style action_logs into Elasticsearch.

Closes-Bug: #1401120
Change-Id: I416e9815b8b4ace7b14c671b643d033e334b8326
This commit is contained in:
Alexander Kislitsky 2014-12-10 17:15:11 +03:00
parent 0096236be6
commit 31f75bd5c6
2 changed files with 39 additions and 12 deletions

View File

@ -147,8 +147,18 @@ MAPPING_FUEL = {
"type": "object",
"properties": {
# http request
"request_data": {"type": "object"},
"response_data": {"type": "object"},
"request_data": {
"type": "object",
"properties": {
"data": {"enabled": False}
}
},
"response_data": {
"type": "object",
"properties": {
"data": {"enabled": False}
}
},
# task
"parent_task_id": {"type": "long"},
"subtasks_ids": {"type": "long"},

View File

@ -1,13 +1,13 @@
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# Licensed under the Apache License, Version 2.0 (the 'License'); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
@ -18,9 +18,6 @@ from migration.test.base import ElasticTest
class ElasticsearchMapping(ElasticTest):
def setUp(self):
super(ElasticsearchMapping, self).setUp()
def test_master_node_uid_not_analyzed(self):
docs = [
{'master_node_uid': 'x0'},
@ -38,11 +35,11 @@ class ElasticsearchMapping(ElasticTest):
# checking master_node_uid tokenizer
master_node_uids = {
"size": 0,
"aggs": {
"structs": {
"terms": {
"field": "master_node_uid"
'size': 0,
'aggs': {
'structs': {
'terms': {
'field': 'master_node_uid'
}
}
}
@ -55,3 +52,23 @@ class ElasticsearchMapping(ElasticTest):
# checking that master_node_uids with whitespaces and
# non-literal symbols didn't split
self.assertEquals(len(docs), len(result))
def test_mixed_values_in_list_migration(self):
doc = {
'master_node_uid': 'x1',
'additional_info': {
'request_data': {
'data': {
'settings': {
'statistics': {
'company': {'restrictions': [
'string', {'a': 'b'}]},
}
}
}
}
}
}
self.es.index(config.INDEX_FUEL, config.DOC_TYPE_ACTION_LOGS, doc,
id=doc['master_node_uid'])