ElasticSearch 多索引

来源:互联网 发布:讨鬼传2 噬神者2 知乎 编辑:程序博客网 时间:2024/06/04 08:02
1、用逗号将索引隔开,如:
$ curl -XPOST http://localhost:9200/aaa,website/_search/
{
  • "took"1,
  • "timed_out"false,
  • "_shards": {
    • "total"10,
    • "successful"10,
    • "failed"0
    },
  • "hits": {
    • "total"5,
    • "max_score"1,
    • "hits": [
      • {
        • "_index""website",
        • "_type""blog",
        • "_id""123",
        • "_score"1,
        • "_source": {
          • "title""My first blog entry",
          • "text""Just trying this out...",
          • "date""2014/01/01"
          }
        },
      • {
        • "_index""website",
        • "_type""blog",
        • "_id""AVbkih8AltSLRRB7XAun",
        • "_score"1,
        • "_source": {
          • "title""TestTitle",
          • "text""text",
          • "date""2016/09/01"
          }
        },
      • {
        • "_index""website",
        • "_type""blog",
        • "_id""AVbf1AtSyvALLDk8cjpY",
        • "_score"1,
        • "_source": {
          • "title""My 3 blog entry",
          • "text""Still trying this out...",
          • "date""2014/01/01"
          }
        },
      • {
        • "_index""aaa",
        • "_type""aaa",
        • "_id""AVcCopjQzgrwoUDkEMu3",
        • "_score"1,
        • "_source": {
          • "str1""hello",
          • "str2""world"
          }
        },
      • {
        • "_index""aaa",
        • "_type""aaa",
        • "_id""AVcCogrMzgrwoUDkEMu2",
        • "_score"1,
        • "_source": {
          • "str1""hello, world!",
          • "str2""goodbye! world"
          }
        }
      ]
    }

}

2、通配符

elasticsearch还支持使用统配的风格,如使用*匹配任意字符。

3、数学表达式风格

最后可以通过add(+)添加一个索引,使用remove(-)去掉一个索引

0 0
原创粉丝点击