如果可以将其更改为包含已设置的位索引的数组。也就是说011100
会[ 1 , 2 ,3 ]
,然后用一个terms
查询做一个or
或一个must
查询and
范例:
a) document with "111"
put test/test/1
{
"bit_position" : [
1,
2,
3
]
}
b) document with 010
put test/test/2
{
"bit_position": [
2
]
}
c) or-ing with 101
post test/_search
{
"query": {
"terms": {
"bit_position": [
1,
3
]
}
}
}