parent
6021515567
commit
a274d9386f
|
@ -1293,10 +1293,13 @@ public class Strings {
|
||||||
* @return the delimited String
|
* @return the delimited String
|
||||||
*/
|
*/
|
||||||
public static String collectionToDelimitedString(Iterable coll, String delim, String prefix, String suffix) {
|
public static String collectionToDelimitedString(Iterable coll, String delim, String prefix, String suffix) {
|
||||||
|
return collectionToDelimitedString(coll, delim, prefix, suffix, new StringBuilder());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String collectionToDelimitedString(Iterable coll, String delim, String prefix, String suffix, StringBuilder sb) {
|
||||||
if (Iterables.isEmpty(coll)) {
|
if (Iterables.isEmpty(coll)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
Iterator it = coll.iterator();
|
Iterator it = coll.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
sb.append(prefix).append(it.next()).append(suffix);
|
sb.append(prefix).append(it.next()).append(suffix);
|
||||||
|
@ -1339,10 +1342,13 @@ public class Strings {
|
||||||
* @return the delimited String
|
* @return the delimited String
|
||||||
*/
|
*/
|
||||||
public static String arrayToDelimitedString(Object[] arr, String delim) {
|
public static String arrayToDelimitedString(Object[] arr, String delim) {
|
||||||
|
return arrayToDelimitedString(arr, delim, new StringBuilder());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String arrayToDelimitedString(Object[] arr, String delim, StringBuilder sb) {
|
||||||
if (isEmpty(arr)) {
|
if (isEmpty(arr)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (int i = 0; i < arr.length; i++) {
|
for (int i = 0; i < arr.length; i++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
sb.append(delim);
|
sb.append(delim);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.elasticsearch.index.search.slowlog;
|
package org.elasticsearch.index.search.slowlog;
|
||||||
|
|
||||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||||
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.logging.ESLogger;
|
import org.elasticsearch.common.logging.ESLogger;
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
|
@ -188,6 +189,20 @@ public class ShardSlowLogSearchService extends AbstractIndexShardComponent {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("took[").append(TimeValue.timeValueNanos(tookInNanos)).append("], took_millis[").append(TimeUnit.NANOSECONDS.toMillis(tookInNanos)).append("], ");
|
sb.append("took[").append(TimeValue.timeValueNanos(tookInNanos)).append("], took_millis[").append(TimeUnit.NANOSECONDS.toMillis(tookInNanos)).append("], ");
|
||||||
|
if (context.types() == null) {
|
||||||
|
sb.append("types[], ");
|
||||||
|
} else {
|
||||||
|
sb.append("types[");
|
||||||
|
Strings.arrayToDelimitedString(context.types(), ",", sb);
|
||||||
|
sb.append("], ");
|
||||||
|
}
|
||||||
|
if (context.groupStats() == null) {
|
||||||
|
sb.append("stats[], ");
|
||||||
|
} else {
|
||||||
|
sb.append("stats[");
|
||||||
|
Strings.collectionToDelimitedString(context.groupStats(), ",", "", "", sb);
|
||||||
|
sb.append("], ");
|
||||||
|
}
|
||||||
sb.append("search_type[").append(context.searchType()).append("], total_shards[").append(context.numberOfShards()).append("], ");
|
sb.append("search_type[").append(context.searchType()).append("], total_shards[").append(context.numberOfShards()).append("], ");
|
||||||
if (context.request().source() != null && context.request().source().length() > 0) {
|
if (context.request().source() != null && context.request().source().length() > 0) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue