From ab326909289954e05e183d6b6a9194d749f6a0de Mon Sep 17 00:00:00 2001 From: Megan Henning <meganhenning@flywheel.io> Date: Tue, 25 Apr 2017 14:48:27 -0500 Subject: [PATCH] Change string to text for 5.x --- api/handlers/dataexplorerhandler.py | 63 ++++++++++++++++++++++++++++- bin/dicom_doctype.py | 8 ++-- 2 files changed, 66 insertions(+), 5 deletions(-) diff --git a/api/handlers/dataexplorerhandler.py b/api/handlers/dataexplorerhandler.py index 75aff09f..bd084c70 100644 --- a/api/handlers/dataexplorerhandler.py +++ b/api/handlers/dataexplorerhandler.py @@ -47,7 +47,7 @@ BASE_QUERY = { } } -FACET_QUERY = { +OLD_FACET_QUERY = { "size": 0, "aggs" : { "Series Description" : { @@ -90,6 +90,67 @@ FACET_QUERY = { } +FACET_QUERY = { + "size": 0, + "aggs" : { + "subect.sex" : { + "terms" : { + "field" : "subect.sex.raw", + "size" : 15 + } + }, + "subject.code" : { + "terms" : { + "field" : "subject.code.raw", + "size" : 15 + } + }, + "session.tags" : { + "terms" : { + "field" : "session.tags.raw", + "size" : 15 + } + }, + "project.label" : { + "terms" : { + "field" : "project.label.raw", + "size" : 15 + } + }, + "file.measurements" : { + "terms" : { + "field" : "file.measurements.raw", + "size" : 15 + } + }, + "file.type" : { + "terms" : { + "field" : "file.type.raw", + "size" : 15 + } + }, + "session.timestamp" : { + "date_histogram" : { + "field" : "session.timestamp", + "interval" : "month" + } + }, + "session.created" : { + "date_histogram" : { + "field" : "session.created", + "interval" : "month" + } + }, + "subject.age" : { + "histogram" : { + "field" : "subject.age", + "interval" : 31556952 + } + } + } +} + + class DataExplorerHandler(base.RequestHandler): def __init__(self, request=None, response=None): diff --git a/bin/dicom_doctype.py b/bin/dicom_doctype.py index 16a9c2c0..665151bb 100755 --- a/bin/dicom_doctype.py +++ b/bin/dicom_doctype.py @@ -44,7 +44,7 @@ DYNAMIC_TEMPLATES = [ 'match': '_id', 'match_mapping_type' : 'string', 'mapping': { - 'type': 'string', + 'type': 'text', 'index': 'not_analyzed' } } @@ -102,7 +102,7 @@ DYNAMIC_TEMPLATES = [ 'match': 'hash', 'match_mapping_type' : 'string', 'mapping': { - 'type': 'string', + 'type': 'text', 'index': 'not_analyzed' } } @@ -112,13 +112,13 @@ DYNAMIC_TEMPLATES = [ 'match': '*', 'match_mapping_type' : 'string', 'mapping' : { - 'type': 'string', + 'type': 'text', 'search_analyzer': 'str_search_analyzer', 'index_analyzer': 'str_index_analyzer', 'ignore_above': 10922, "fields": { "raw": { - "type": "string", + "type": "text", "index": "not_analyzed", "ignore_above": 256 } -- GitLab