NEST string sort

The text string sort will be segmented first. You can create the filed field first. And set it as keyword

mapping

 public void Mapping()
        {
            var response = client.IndexExists("employee");
            if (!response.Exists)
            {
                client.CreateIndex("employee");
            }
            client.Map(m => m.Properties(p => p.Text(t => t.Name("last_name").Fielddata().Analyzer("english").Fields(f=>f .Keyword(k=>k.Name("raw"))))).AutoMap());
        }

  

sort

 public void Sort()

{
// client.Search(s => s. Query(q => q.Bool(b => b.Filter(f => f.Term(t => t.Field("last_name").Value("test01"))))).Pretty()) ;
client.Search(s =>
s.Query(q
=>
q.ConstantScore(c
=>
c.Filter(f
=>
f.Term(t
=>
t.Field(
"age").Value("26")
))))
.Sort(so
=>
so.Descending(
"last_name")
)
.Pretty());

}

Share a picture

 public void Mapping()
        {
            var response = client.IndexExists("employee");
            if (!response.Exists)
            {
                client.CreateIndex("employee");
            }
            client.Map(m => m.Properties(p => p.Text(t => t.Name("last_name").Fielddata().Analyzer("english").Fields(f=>f .Keyword(k=>k.Name("raw"))))).AutoMap());
        }

 public void Sort()

{
// client.Search(s => s. Query(q => q.Bool(b => b.Filter(f => f.Term(t => t.Field("last_name").Value("test01"))))).Pretty()) ;
client.Search(s =>
s.Query(q
=>
q.ConstantScore(c
=>
c.Filter(f
=>
f.Term(t
=>
t.Field(
"age").Value("26")
))))
.Sort(so
=>
so.Descending(
"last_name")
)
.Pretty());

}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2702 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.