hsiuming
(hsiuming)
November 16, 2017, 6:54am
1
Hello
We now create a data table in visualize.
Now we need to filter two data keyword in the same column.
For example,the content of table is:
cloumn count
data1 1
data2 1
data3 1
data4 1
data5 1
We want to add filter only to show data2 and data3 in the table.
If I use the "Add a filter" function to add two filter, the table will be empty.
I also modify the Query DSL with the command:
{
"query": {
"match": {
"column.keyword": {
"query": "data2",
"type": "phrase"
}
}
},
"query": {
"match": {
"column.keyword": {
"query": "data3",
"type": "phrase"
}
}
}
}
But the filter always only update to the latest query function,not two filter 'OR' logic.
How can I set these filter?
warkolm
(Mark Walkom)
November 16, 2017, 9:21am
2
Maybe try;
"should" : [
{ "term" : { "data2" : "phrase" } },
{ "term" : { "data3" : "phrase" } }
],
From https://www.elastic.co/guide/en/elasticsearch/reference/6.0/query-dsl-bool-query.html
warkolm
(Mark Walkom)
November 17, 2017, 12:23am
4
Awesome, can you share the entire thing, it might help someone in future
hsiuming
(hsiuming)
November 17, 2017, 1:57am
5
The full Query DSL command is:
{
"query": {
"bool": {
"should": [
{
"match": {
"column.keyword": {
"query": "data2",
"type": "phrase"
}
}
},
{
"match": {
"column.keyword": {
"query": "data3",
"type": "phrase"
}
}
}
]
}
}
}
it's a "OR" condition.
1 Like
system
(system)
Closed
December 15, 2017, 1:57am
6
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.