我已经查看了StackOverflow和Elastic站点上的其他示例,但是我无法将这个组合的Elasticsearch查询工作。
单独的projectName和timestamp查询有效,但不是这个组合查询:
public void Recorder_Prepare() {
recorder = new MediaRecorder();
recorder.setPreviewDisplay(holder.getSurface());
mCamera.unlock();
recorder.setCamera(mCamera);
recorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setProfile(camcorderProfile);
recorder.setVideoSize(ResolutionWidth, ResolutionHeight);
recorder.setVideoFrameRate(camcorderProfile.videoFrameRate);
createFile(“Video.mp4”);
}
private void createFile(String fileName) {
String mimeType = "video/mp4";
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType(mimeType);
intent.putExtra(Intent.EXTRA_TITLE, fileName);
startActivityForResult(intent, WRITE_REQUEST_CODE
}
@Override
public void onActivityResult(int requestCode, int resultCode,Intent resultData) {
if (requestCode == WRITE_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
if (resultData != null) {
URI outputFileUri = resultData.getData();
FileDescriptor outputFileDescriptor = getContentResolver().openFileDescriptor(outputFileUri, "w").getFileDescriptor()
recorder.setOutputFile(outputFileDescriptor);
try {
recorder.prepare();
}
catch (IllegalStateException e) {
Log.e("MyTag", "IllegalStateException : " + Log.getStackTraceString(e)); }
catch (IOException e) {
Log.e("MyTag", "IOException : " + Log.getStackTraceString(e)); }
recorder.start();
}
}
}
答案 0 :(得分:1)
我更改了两件事,-d'之间缺少空格,但不确定这是否有问题。另一件事是第二个查询。这应该在bool>必须部分内。这应该有效:
curl -XGET "http://localhost/jenkins/_search/exists" -d '
{
"query" : {
"bool": {
"must": [
{
"match": {
"data.projectName": {
"query": "QA_Deployment",
"type": "phrase"
}
}
},
{
"range": {
"@timestamp": {
"gte": "now-30d",
"lte": "now"
}
}
}
]
}
}
}'