KarlC

萌新请教一个 ES 字符数组过滤问题

  •  
  •   KarlC · Jun 22, 2021 · 8662 views
    This topic created in 1965 days ago, the information mentioned may be changed or developed.
    索引中某个字段的值是字符数组,例如"test": ["test1", "test2"],查询的时候怎么过滤数组中某个值,只知道 long 类型可以直接过滤,但是这种复合类型似乎不行,mapping 是
    "mappings" : {
    "properties" : {
    "test" : {
    "type" : "text",
    "fields" : {
    "keyword" : {
    "type" : "keyword",
    "ignore_above" : 256
    }
    }
    }
    }
    }
    4 replies  •  2021-06-22 13:17:48 +08:00
    misaka19000
    misaka19000
    Jun 22, 2021
    1
    可以直接过滤的

    {"term":{"test":"test1"}}
    X0ray
    X0ray
    Jun 22, 2021
    2
    跟基础类型一个查法
    KarlC
    KarlC
    OP
    Jun 22, 2021 via Android
    3
    @misaka19000 懂了,谢谢
    KarlC
    KarlC
    OP
    Jun 22, 2021 via Android
    4
    @X0ray 原来多个值也是可以分开过滤的,明白了,谢谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1439 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 11:06 · PVG 19:06 · LAX 03:06 · JFK 06:06
    ♥ Do have faith in what you're doing.