首页 > 其他 > 详细

NEST 多IndexType与分页

时间:2019-09-19 12:58:02      阅读:165      评论:0      收藏:0      [点我收藏+]
       /// <summary>
        /// POST /_all/employee/_search?typed_keys=true
        /// </summary>
        public void AllIndex()
        {
            client.Search<employee>(s => s.AllIndices().Query(q => q.Match(m => m.Field(f => f.last_name).Query("狮"))));
        }

        /// <summary>
        /// POST /employee%2Ctest01/employee/_search?typed_keys=true&pretty=true
        /// </summary>
        public void MultiIndex()
        {
            client.Search<employee>(s => s.Index("employee,test01").Pretty());
        }

        /// <summary>
        /// POST /employee%2Ctest01%2Ctest02/employee%2Cemployee2/_search?typed_keys=true&pretty=true
        /// </summary>
        public void MultiType()
        {
            client.Search<employee>(s => s.Index("employee,test01,test02").Type("employee,employee2").Pretty());
        }

        /// <summary>
        /// page
        /// </summary>
        public void Page()
        {
            var request = new SearchRequest("employee", "employee");

            request.From = 0;
            request.Size = 10;
            request.Query = new QueryContainer();

            client.Search<employee>(request);
            //client.Search<employee>(s=>s.From(0).Size(10));
        }

  

NEST 多IndexType与分页

原文:https://www.cnblogs.com/chenyishi/p/11548507.html

(1)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!