Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
63f6e86e
Commit
63f6e86e
authored
Jan 06, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ES): better support for text type, closes #7151
parent
658d3994
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
public/app/plugins/datasource/elasticsearch/datasource.js
+17
-5
No files found.
public/app/plugins/datasource/elasticsearch/datasource.js
View file @
63f6e86e
...
@@ -231,6 +231,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
...
@@ -231,6 +231,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
this
.
getFields
=
function
(
query
)
{
this
.
getFields
=
function
(
query
)
{
return
this
.
_get
(
'/_mapping'
).
then
(
function
(
result
)
{
return
this
.
_get
(
'/_mapping'
).
then
(
function
(
result
)
{
var
typeMap
=
{
var
typeMap
=
{
'float'
:
'number'
,
'float'
:
'number'
,
'double'
:
'number'
,
'double'
:
'number'
,
...
@@ -238,14 +239,28 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
...
@@ -238,14 +239,28 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
'long'
:
'number'
,
'long'
:
'number'
,
'date'
:
'date'
,
'date'
:
'date'
,
'string'
:
'string'
,
'string'
:
'string'
,
'text'
:
'
text
'
,
'text'
:
'
string
'
,
'scaled_float'
:
'number'
,
'scaled_float'
:
'number'
,
'nested'
:
'nested'
'nested'
:
'nested'
};
};
function
shouldAddField
(
obj
,
key
,
query
)
{
if
(
key
[
0
]
===
'_'
)
{
return
false
;
}
if
(
!
query
.
type
)
{
return
true
;
}
// equal query type filter, or via typemap translation
return
query
.
type
===
obj
.
type
||
query
.
type
===
typeMap
[
obj
.
type
];
}
// Store subfield names: [system, process, cpu, total] -> system.process.cpu.total
// Store subfield names: [system, process, cpu, total] -> system.process.cpu.total
var
fieldNameParts
=
[];
var
fieldNameParts
=
[];
var
fields
=
{};
var
fields
=
{};
function
getFieldsRecursively
(
obj
)
{
function
getFieldsRecursively
(
obj
)
{
for
(
var
key
in
obj
)
{
for
(
var
key
in
obj
)
{
var
subObj
=
obj
[
key
];
var
subObj
=
obj
[
key
];
...
@@ -258,10 +273,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
...
@@ -258,10 +273,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
var
fieldName
=
fieldNameParts
.
concat
(
key
).
join
(
'.'
);
var
fieldName
=
fieldNameParts
.
concat
(
key
).
join
(
'.'
);
// Hide meta-fields and check field type
// Hide meta-fields and check field type
if
(
key
[
0
]
!==
'_'
&&
if
(
shouldAddField
(
subObj
,
key
,
query
))
{
(
!
query
.
type
||
query
.
type
&&
typeMap
[
subObj
.
type
]
===
query
.
type
))
{
fields
[
fieldName
]
=
{
fields
[
fieldName
]
=
{
text
:
fieldName
,
text
:
fieldName
,
type
:
subObj
.
type
type
:
subObj
.
type
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment