Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions x-pack/legacy/plugins/maps/mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
"indexPatternsWithGeoFieldCount": {
"type": "long"
},
"indexPatternsWithGeoPointFieldCount": {
"type": "long"
},
"indexPatternsWithGeoShapeFieldCount": {
"type": "long"
},
"mapsTotalCount": {
"type": "long"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ describe('buildMapsTelemetry', () => {

expect(result).toMatchObject({
indexPatternsWithGeoFieldCount: 0,
indexPatternsWithGeoPointFieldCount: 0,
indexPatternsWithGeoShapeFieldCount: 0,
attributesPerMap: {
dataSourcesCount: {
avg: 0,
Expand All @@ -45,7 +47,9 @@ describe('buildMapsTelemetry', () => {
const result = buildMapsTelemetry({ mapSavedObjects, indexPatternSavedObjects, settings });

expect(result).toMatchObject({
indexPatternsWithGeoFieldCount: 2,
indexPatternsWithGeoFieldCount: 3,
indexPatternsWithGeoPointFieldCount: 2,
indexPatternsWithGeoShapeFieldCount: 1,
attributesPerMap: {
dataSourcesCount: {
avg: 2.6666666666666665,
Expand Down
26 changes: 22 additions & 4 deletions x-pack/legacy/plugins/maps/server/maps_telemetry/maps_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,27 @@ function getIndexPatternsWithGeoFieldCount(indexPatterns: IIndexPattern[]) {
? JSON.parse(indexPattern.attributes.fields)
: []
);

const fieldListsWithGeoFields = fieldLists.filter(fields =>
fields.some(
(field: IFieldType) =>
field.type === ES_GEO_FIELD_TYPE.GEO_POINT || field.type === ES_GEO_FIELD_TYPE.GEO_SHAPE
)
);
return fieldListsWithGeoFields.length;

const fieldListsWithGeoPointFields = fieldLists.filter(fields =>
fields.some((field: IFieldType) => field.type === ES_GEO_FIELD_TYPE.GEO_POINT)
);

const fieldListsWithGeoShapeFields = fieldLists.filter(fields =>
fields.some((field: IFieldType) => field.type === ES_GEO_FIELD_TYPE.GEO_SHAPE)
);

return {
indexPatternsWithGeoFieldCount: fieldListsWithGeoFields.length,
indexPatternsWithGeoPointFieldCount: fieldListsWithGeoPointFields.length,
indexPatternsWithGeoShapeFieldCount: fieldListsWithGeoShapeFields.length,
};
}

export function buildMapsTelemetry({
Expand Down Expand Up @@ -110,12 +124,16 @@ export function buildMapsTelemetry({
const dataSourcesCountSum = _.sum(dataSourcesCount);
const layersCountSum = _.sum(layersCount);

const indexPatternsWithGeoFieldCount = getIndexPatternsWithGeoFieldCount(
indexPatternSavedObjects
);
const {
indexPatternsWithGeoFieldCount,
indexPatternsWithGeoPointFieldCount,
indexPatternsWithGeoShapeFieldCount,
} = getIndexPatternsWithGeoFieldCount(indexPatternSavedObjects);
return {
settings,
indexPatternsWithGeoFieldCount,
indexPatternsWithGeoPointFieldCount,
indexPatternsWithGeoShapeFieldCount,
// Total count of maps
mapsTotalCount: mapsCount,
// Time of capture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@
"updated_at": "2019-11-19T20:05:37.607Z",
"version": "WzExMSwxXQ=="
},
{
"attributes": {
"fields": "[{\"name\":\"geometry\",\"type\":\"geo_point\",\"esTypes\":[\"geo_point\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]",
"title": "indexpattern-with-geopoint2"
},
"id": "55d572f0-0b07-11ea-9dd2-95afd7ad44d4",
"migrationVersion": {
"index-pattern": "7.6.0"
},
"references": [],
"type": "index-pattern",
"updated_at": "2019-11-19T20:05:37.607Z",
"version": "WzExMSwxXQ=="
},
{
"attributes": {
"fields": "[{\"name\":\"assessment_date\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"date_exterior_condition\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"recording_date\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"sale_date\",\"type\":\"date\",\"esTypes\":[\"date\"],\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]",
Expand Down