private void sendDocsStats(String name, DocsStats docsStats) { sendInt(name, "count", docsStats.getCount()); sendInt(name, "deleted", docsStats.getDeleted()); }
/** * Creates a new search index statistics objects per specified parameters. * * @param settings the search index settings * @param docsStats the search index docs stats * @param indexCount the count of index * * @return the newly created search index statistics object */ protected SearchIndexStatistics createSearchIndexStatistics(Settings settings, DocsStats docsStats, long indexCount) { SearchIndexStatistics searchIndexStatistics = new SearchIndexStatistics(); Long creationDate = settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1L); if (creationDate.longValue() != -1L) { DateTime creationDateTime = new DateTime(creationDate, DateTimeZone.UTC); searchIndexStatistics.setIndexCreationDate(HerdDateUtils.getXMLGregorianCalendarValue(creationDateTime.toDate())); } searchIndexStatistics.setIndexNumberOfActiveDocuments(docsStats.getCount()); searchIndexStatistics.setIndexNumberOfDeletedDocuments(docsStats.getDeleted()); searchIndexStatistics.setIndexUuid(settings.get(IndexMetaData.SETTING_INDEX_UUID)); searchIndexStatistics.setIndexCount(indexCount); return searchIndexStatistics; }
/** * Creates a new search index statistics objects per specified parameters. * * @param settings the search index settings * @param docsStats the search index docs stats * @param indexCount the count of index * * @return the newly created search index statistics object */ protected SearchIndexStatistics createSearchIndexStatistics(Settings settings, DocsStats docsStats, long indexCount) { SearchIndexStatistics searchIndexStatistics = new SearchIndexStatistics(); Long creationDate = settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1L); if (creationDate.longValue() != -1L) { DateTime creationDateTime = new DateTime(creationDate, DateTimeZone.UTC); searchIndexStatistics.setIndexCreationDate(HerdDateUtils.getXMLGregorianCalendarValue(creationDateTime.toDate())); } searchIndexStatistics.setIndexNumberOfActiveDocuments(docsStats.getCount()); searchIndexStatistics.setIndexNumberOfDeletedDocuments(docsStats.getDeleted()); searchIndexStatistics.setIndexUuid(settings.get(IndexMetaData.SETTING_INDEX_UUID)); searchIndexStatistics.setIndexCount(indexCount); return searchIndexStatistics; }
private void updateStoreDocs(NodeIndicesStatsBean nodeIndicesStatsBean, NodeIndicesStats nodeIndicesStats) { nodeIndicesStatsBean.storeSize = nodeIndicesStats.getStore().getSizeInBytes(); nodeIndicesStatsBean.storeThrottleTime = nodeIndicesStats.getStore().getThrottleTime().millis(); nodeIndicesStatsBean.docsCount = nodeIndicesStats.getDocs().getCount(); nodeIndicesStatsBean.docsDeleted = nodeIndicesStats.getDocs().getDeleted(); }
when(indexFunctionsDao.getIndexStats(SEARCH_INDEX_NAME)).thenReturn(mockedDocsStats); when(mockedDocsStats.getCount()).thenReturn(SEARCH_INDEX_STATISTICS_NUMBER_OF_ACTIVE_DOCUMENTS); when(mockedDocsStats.getDeleted()).thenReturn(SEARCH_INDEX_STATISTICS_NUMBER_OF_DELETED_DOCUMENTS); when(configurationHelper.getProperty(ConfigurationValue.ELASTICSEARCH_BDEF_DOCUMENT_TYPE, String.class)).thenReturn("doc"); when(indexFunctionsDao.getNumberOfTypesInIndex(any(), any())).thenReturn(0l); verify(searchIndexDaoHelper).getSearchIndexEntity(searchIndexKey); verify(mockedDocsStats).getCount(); verify(mockedDocsStats).getDeleted(); verify(indexFunctionsDao).getIndexSettings(SEARCH_INDEX_NAME); verify(indexFunctionsDao).getIndexStats(SEARCH_INDEX_NAME);
@Test public void testCreateSearchIndexStatisticsNoIndexCreationDate() { // Create a search index get settings response without the index creation date setting. ImmutableOpenMap<String, Settings> getIndexResponseSettings = ImmutableOpenMap.<String, Settings>builder() .fPut(SEARCH_INDEX_NAME, Settings.builder().put(IndexMetaData.SETTING_INDEX_UUID, SEARCH_INDEX_STATISTICS_INDEX_UUID).build()).build(); // Mock an index docs stats object. DocsStats mockedDocsStats = mock(DocsStats.class); when(mockedDocsStats.getCount()).thenReturn(SEARCH_INDEX_STATISTICS_NUMBER_OF_ACTIVE_DOCUMENTS); when(mockedDocsStats.getDeleted()).thenReturn(SEARCH_INDEX_STATISTICS_NUMBER_OF_DELETED_DOCUMENTS); // Get a search index settings created. SearchIndexStatistics response = searchIndexServiceImpl.createSearchIndexStatistics(getIndexResponseSettings.get(SEARCH_INDEX_NAME), mockedDocsStats, 0l); // Verify the external calls. verifyNoMoreInteractions(alternateKeyHelper, businessObjectDefinitionDao, businessObjectDefinitionHelper, configurationDaoHelper, configurationHelper, searchIndexDao, searchIndexDaoHelper, searchIndexHelperService, searchIndexStatusDaoHelper, searchIndexTypeDaoHelper); // Validate the returned object. assertEquals(new SearchIndexStatistics(NO_SEARCH_INDEX_STATISTICS_CREATION_DATE, SEARCH_INDEX_STATISTICS_NUMBER_OF_ACTIVE_DOCUMENTS, SEARCH_INDEX_STATISTICS_NUMBER_OF_DELETED_DOCUMENTS, SEARCH_INDEX_STATISTICS_INDEX_UUID, 0l), response); }
table.addCell(primaryStats.getDocs() == null ? null : primaryStats.getDocs().getDeleted());
table.addCell(primaryStats.getDocs() == null ? null : primaryStats.getDocs().getDeleted());
table.addCell(primaryStats.getDocs() == null ? null : primaryStats.getDocs().getDeleted());
table.addCell(indexHealth == null ? null : indexHealth.getNumberOfReplicas()); table.addCell(indexStats == null ? null : indexStats.getPrimaries().getDocs().getCount()); table.addCell(indexStats == null ? null : indexStats.getPrimaries().getDocs().getDeleted());
table.addCell(indexHealth == null ? null : indexHealth.getNumberOfReplicas()); table.addCell(indexStats == null ? null : indexStats.getPrimaries().getDocs().getCount()); table.addCell(indexStats == null ? null : indexStats.getPrimaries().getDocs().getDeleted());