如何删除Elasticsearch响应中的特定响应正文字段内容。
我在Elasticsearch的回复主体是,
{
"took": 67,
"timed_out": false,
"_shards": {
"total": 331,
"successful": 331,
"skipped": 321,
"failed": 0
},
"hits": {
"total": 5344,
"max_score": 4.2037153,
"hits": [
{
"_index": "Test-2018.03.22",
"_type": "Emp",
"_id": "df4354yy5465645tytryytI",
"_score": 4.2037153,
"_source": {
"time": "2018-03-22T12:46:39.6259805Z",
"Sample": "Info",
"Active": "Avaliable",
"ProcessCheck1": "0",
"ProgramId2": "0",
}
},
]
}
}
有没有办法删除它们,所以我可以有以下结构,
{
"hits": {
"total": 5344,
"hits": [
{
"_source": {
"time": "2018-03-22T12:46:39.6259805Z",
"Sample": "Info",
}
},
]
}
}
感谢您的阅读。我将非常感谢您的帮助!
答案 0 :(得分:1)
希望它会对你有所帮助:
//this is initial string url ====> http://www.articler.ir/android_php/search.php?Method=rate&CAT=مهندسی%20عمران
String MyKey = مهندسی عمران;
final String EncodeKey= URLEncoder.encode(MyKey , "UTF-8");
String EncodeURL = " http://www.articler.ir/android_php/search.php?Method=rate&CAT= " + EncodeKey;
在curl -XGET 'localhost:9200/Test-2018.03.22/_search?_source=time,Sample&filter_path=hits.total,hits.hits._source&pretty'
中,您可以指定逗号分隔的所有字段。