質問編集履歴
3
誤記修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,67 +42,59 @@
|
|
42
42
|
|
43
43
|
"bool": {
|
44
44
|
|
45
|
-
"
|
45
|
+
"must": [
|
46
46
|
|
47
|
-
|
47
|
+
{
|
48
48
|
|
49
|
-
"
|
49
|
+
"bool": {
|
50
50
|
|
51
|
-
|
51
|
+
"should": [
|
52
52
|
|
53
|
-
|
53
|
+
{
|
54
54
|
|
55
|
-
"
|
55
|
+
"match": {
|
56
56
|
|
57
|
-
"
|
57
|
+
"user_id": "id001"
|
58
58
|
|
59
|
-
|
59
|
+
}
|
60
60
|
|
61
|
+
},
|
62
|
+
|
63
|
+
{
|
64
|
+
|
65
|
+
"match": {
|
66
|
+
|
61
|
-
"
|
67
|
+
"user_id_list": "id001"
|
62
68
|
|
63
69
|
}
|
64
70
|
|
65
71
|
}
|
66
72
|
|
73
|
+
]
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
},
|
78
|
+
|
79
|
+
{
|
80
|
+
|
81
|
+
"range": {
|
82
|
+
|
83
|
+
"timestamp": {
|
84
|
+
|
85
|
+
"gte": "1552790121119",
|
86
|
+
|
87
|
+
"lte": 1552790121120,
|
88
|
+
|
89
|
+
"format": "epoch_millis"
|
90
|
+
|
67
91
|
}
|
68
92
|
|
69
|
-
|
93
|
+
}
|
70
94
|
|
71
95
|
}
|
72
96
|
|
73
|
-
},
|
74
|
-
|
75
|
-
"must": {
|
76
|
-
|
77
|
-
"bool": {
|
78
|
-
|
79
|
-
"should": [
|
80
|
-
|
81
|
-
{
|
82
|
-
|
83
|
-
"match": {
|
84
|
-
|
85
|
-
"user_id": "id001"
|
86
|
-
|
87
|
-
}
|
88
|
-
|
89
|
-
},
|
90
|
-
|
91
|
-
{
|
92
|
-
|
93
|
-
"match": {
|
94
|
-
|
95
|
-
"user_id_list": "id001"
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
}
|
100
|
-
|
101
|
-
|
97
|
+
]
|
102
|
-
|
103
|
-
}
|
104
|
-
|
105
|
-
}
|
106
98
|
|
107
99
|
}
|
108
100
|
|
2
質問の一部を修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,23 +14,47 @@
|
|
14
14
|
|
15
15
|
{
|
16
16
|
|
17
|
+
"sort": [
|
18
|
+
|
19
|
+
{
|
20
|
+
|
21
|
+
"timestamp": {
|
22
|
+
|
23
|
+
"order": "desc"
|
24
|
+
|
25
|
+
}
|
26
|
+
|
27
|
+
},
|
28
|
+
|
29
|
+
{
|
30
|
+
|
31
|
+
"_id": {
|
32
|
+
|
33
|
+
"order": "asc"
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
}
|
38
|
+
|
39
|
+
],
|
40
|
+
|
17
41
|
"query": {
|
18
42
|
|
19
43
|
"bool": {
|
20
44
|
|
21
|
-
"
|
45
|
+
"1": {
|
22
46
|
|
23
|
-
{
|
47
|
+
"bool": {
|
24
48
|
|
25
|
-
"
|
49
|
+
"must": [
|
26
50
|
|
27
|
-
|
51
|
+
{
|
28
52
|
|
29
53
|
"range": {
|
30
54
|
|
31
55
|
"timestamp": {
|
32
56
|
|
33
|
-
"gte": 1552790121119,
|
57
|
+
"gte": "1552790121119",
|
34
58
|
|
35
59
|
"lte": "1552790121120",
|
36
60
|
|
@@ -42,43 +66,43 @@
|
|
42
66
|
|
43
67
|
}
|
44
68
|
|
45
|
-
|
69
|
+
]
|
46
70
|
|
47
|
-
}
|
71
|
+
}
|
48
72
|
|
49
|
-
|
73
|
+
},
|
50
74
|
|
51
|
-
|
75
|
+
"must": {
|
52
76
|
|
53
|
-
|
77
|
+
"bool": {
|
54
78
|
|
55
|
-
|
79
|
+
"should": [
|
56
80
|
|
57
|
-
|
81
|
+
{
|
58
82
|
|
59
|
-
|
83
|
+
"match": {
|
60
84
|
|
61
|
-
}
|
62
|
-
|
63
|
-
},
|
64
|
-
|
65
|
-
{
|
66
|
-
|
67
|
-
"match": {
|
68
|
-
|
69
|
-
|
85
|
+
"user_id": "id001"
|
70
|
-
|
71
|
-
}
|
72
86
|
|
73
87
|
}
|
74
88
|
|
75
|
-
|
89
|
+
},
|
76
90
|
|
91
|
+
{
|
92
|
+
|
93
|
+
"match": {
|
94
|
+
|
95
|
+
"user_id_list": "id001"
|
96
|
+
|
77
|
-
}
|
97
|
+
}
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
]
|
78
102
|
|
79
103
|
}
|
80
104
|
|
81
|
-
|
105
|
+
}
|
82
106
|
|
83
107
|
}
|
84
108
|
|
1
質問内容を一部修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
Elasticsearchで以下のクエリを作成したのですが部分一致ではなく完全一致で検索したいです。
|
2
|
-
|
3
|
-
どのようにすればよいでしょうか
|
4
2
|
|
5
3
|
|
6
4
|
|
7
|
-
以下のsearchクエリは
|
5
|
+
以下のsearchクエリはtimestampが1552790121119から1552790121120であり、user_idかuser_id_listがid001のレコードを検索することを期待しているのですが、user_idやuser_id_listが部分一致で検索されてしまいます
|
8
6
|
|
9
7
|
|
8
|
+
|
9
|
+
どのようにしたらよいでしょうか
|
10
10
|
|
11
11
|
|
12
12
|
|
@@ -22,9 +22,25 @@
|
|
22
22
|
|
23
23
|
{
|
24
24
|
|
25
|
-
"
|
25
|
+
"bool": {
|
26
26
|
|
27
|
+
"must": {
|
28
|
+
|
29
|
+
"range": {
|
30
|
+
|
31
|
+
"timestamp": {
|
32
|
+
|
33
|
+
"gte": 1552790121119,
|
34
|
+
|
35
|
+
"lte": "1552790121120",
|
36
|
+
|
27
|
-
"
|
37
|
+
"format": "epoch_millis"
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
}
|
28
44
|
|
29
45
|
}
|
30
46
|
|
@@ -32,27 +48,31 @@
|
|
32
48
|
|
33
49
|
{
|
34
50
|
|
35
|
-
"
|
51
|
+
"bool": {
|
36
52
|
|
37
|
-
"
|
53
|
+
"should": [
|
38
54
|
|
39
|
-
|
55
|
+
{
|
40
56
|
|
41
|
-
|
57
|
+
"match": {
|
42
58
|
|
43
|
-
|
59
|
+
"user_id": "id001"
|
44
60
|
|
45
|
-
|
61
|
+
}
|
46
62
|
|
47
|
-
|
63
|
+
},
|
48
64
|
|
49
|
-
|
65
|
+
{
|
50
66
|
|
51
|
-
"
|
67
|
+
"match": {
|
52
68
|
|
53
|
-
"
|
69
|
+
"user_id_list": "id001"
|
54
70
|
|
55
|
-
}
|
71
|
+
}
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
]
|
56
76
|
|
57
77
|
}
|
58
78
|
|