Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bulk request logging changes #1

Merged
merged 3 commits into from Oct 23, 2014
Merged

Conversation

@srimaruti
Copy link

@srimaruti srimaruti commented Oct 23, 2014

1) Latency, requestSize logging
    1) Latency, requestSize logging
import java.util.Map;
import java.util.Set;
import java.net.InetSocketAddress;
import java.util.*;

This comment has been minimized.

@vkroz

vkroz Oct 23, 2014

Our coding convention is not to import '*', but to specify import class explicitly

logger.error("Error generating json shard stats", e);
}
//logger.info("Slowest shard for request id " + bulkId + ",index=" + slowestIndex + ",shardId=" + slowestShardId);
listener.onResponse(new BulkResponse(responses.toArray(new BulkItemResponse[responses.length()]), bulkTimeMillis));

This comment has been minimized.

@duttly

duttly Oct 23, 2014

Minor, but you may want to log the BulkResponse right at the start. Makes for easier reading.

This comment has been minimized.

@srimaruti

srimaruti Oct 23, 2014
Author

Here we are logging response latency per shard. So we need to wait for all the responses to comeback for all the sub requests associated with the bulk request

}
}

class SlowShard {

This comment has been minimized.

@vkroz

vkroz Oct 23, 2014

Does this class in use anywhere? I can't see where it is used

vkroz added a commit that referenced this pull request Oct 23, 2014
bulk request logging changes
@vkroz vkroz merged commit 289f42c into loggly:loggly/1.3.4 Oct 23, 2014
zzbennett pushed a commit that referenced this pull request May 12, 2016
This change adds a new "filter_path" parameter that can be used to filter and reduce the responses returned by the REST API of elasticsearch.

For example, returning only the shards that failed to be optimized:
```
curl -XPOST 'localhost:9200/beer/_optimize?filter_path=_shards.failed'
{"_shards":{"failed":0}}%
```

It supports multiple filters (separated by a comma):
```
curl -XGET 'localhost:9200/_mapping?pretty&filter_path=*.mappings.*.properties.name,*.mappings.*.properties.title'
```

It also supports the YAML response format. Here it returns only the `_id` field of a newly indexed document:
```
curl -XPOST 'localhost:9200/library/book?filter_path=_id' -d '---hello:\n  world: 1\n'
---
_id: "AU0j64-b-stVfkvus5-A"
```

It also supports wildcards. Here it returns only the host name of every nodes in the cluster:
```
curl -XGET 'http://localhost:9200/_nodes/stats?filter_path=nodes.*.host*'
{"nodes":{"lvJHed8uQQu4brS-SXKsNA":{"host":"portable"}}}
```

And "**" can be used to include sub fields without knowing the exact path. Here it returns only the Lucene version of every segment:
```
curl 'http://localhost:9200/_segments?pretty&filter_path=indices.**.version'
{
  "indices" : {
    "beer" : {
      "shards" : {
        "0" : [ {
          "segments" : {
            "_0" : {
              "version" : "5.2.0"
            },
            "_1" : {
              "version" : "5.2.0"
            }
          }
        } ]
      }
    }
  }
}
```

Note that elasticsearch sometimes returns directly the raw value of a field, like the _source field. If you want to filter _source fields, you should consider combining the already existing _source parameter (see Get API for more details) with the filter_path parameter like this:

```
curl -XGET 'localhost:9200/_search?pretty&filter_path=hits.hits._source&_source=title'
{
  "hits" : {
    "hits" : [ {
      "_source":{"title":"Book #2"}
    }, {
      "_source":{"title":"Book #1"}
    }, {
      "_source":{"title":"Book elastic#3"}
    } ]
  }
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.