Elasticsearch some option issues when creating an index

Source: Internet
Author: User
I want to use Elasticsearch for blog posts to do the site search, backstage with PHP.

The full fields of the article table articles are as follows:

id     title     content     user_id    created_at     updated_at

Now I want to create an index of three fields for the title field, the Content field, and the Updated_at field of the article table.

Here is my reference to the official document of the elasticsearch-php client to create an index blog and create a type article demo, participle used to IK participle.

Some of these options are not clear what the meaning, the specific problem in the following code (there are 4), please God to help answer, thank you.

Official Document Link: https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/_index_management_operations.html# _create_an_index_advanced_example

        $params = [' Index ' = ' blog ', ' body ' = = [' Settings ' = [  ' Number_of_shards ' = 1, ' Number_of_replicas ' + 0, ' analysis '                            [' Filter ' = + [///1, two shingle here should be changed to article?                        ' Shingle ' = [' type ' = ' shingle '] ],//2, what does the contents of Char_filter mean?                        including Pre_negs and Post_negs. ' Char_filter ' = [' pre_negs ' = [' type ' = ' = ' Pattern_r Eplace ', ' pattern ' = ' (\\w+) \\s+ (? I:never|no|nothing|nowhere|noone|none|not|havent|has nt|hadnt|cant|couldnt|shouldnt|wont|wouldnt|dont|doesnt|didnt|isnt|arent|aint)) \\b ', ' Repla                    Cement ' = ' ~$1 '        ], ' post_negs ' = [' type ' = ' pattern_replace ', ' Pattern ' = ' \\b ' (? I:never|no|nothing|nowhere|noone|none|not|havent|hasnt|hadnt|cant|cou Ldnt|shouldnt|wont|wouldnt|dont|doesnt|didnt|isnt|arent|aint) \\s+ (\\w+) ', ' Replacement ' =& Gt                        ' $ ~$2 '],//3, Analyzer's content needs to be modified? ' Analyzer ' and ' [' blog ' = [' type ' = ' + ' cus Tom ', ' tokenizer ' = ' standard ', ' filter ' and ' = ' Lowerca                Se ', ' stop ', ' Kstem ']]],                            ' Mappings ' = [' article ' and ' [' _all ' = [ "Analyzer" =&GT "Ik_max_word", "search_analyzer" = "Ik_max_word", "Term_vector"  = "No", "store" = "false"], ' properties '                                = = [' title ' = = ' type ' = ' string ',                                ' Store ' = ' no ', ' term_vector ' = ' with_positions_offsets ',                                 ' Analyzer ' = ' ik_max_word ', ' search_analyzer ' = ' Ik_max_word ',                            ' Include_in_all ' = ' true ', ' boost ' = 9                                ], ' content ' = = [' Type ' = ' string ',                      ' Store ' = ' no ', ' term_vector ' = ' with_positions_offsets ',           ' Analyzer ' = ' ik_max_word ', ' search_analyzer ' = ' Ik_max_word ',                            ' Include_in_all ' = ' true ', ' boost ' = 8                            ],//4, time is only used in the search when the sort used, the following options how to fill?                                ' Updated_at ' = [' type ' = ' = ', ' store ' = = ',                                ' Term_vector ' = ', ' analyzer '                                ' Search_analyzer ' = ', ' include_in_all ' and ', '            ' Boost ' = []]]        ]        ]; $client->indices ()->create ($params);

Reply content:

I want to use Elasticsearch for blog posts to do the site search, backstage with PHP.

The full fields of the article table articles are as follows:

id     title     content     user_id    created_at     updated_at

Now I want to create an index of three fields for the title field, the Content field, and the Updated_at field of the article table.

Here is my reference to the official document of the elasticsearch-php client to create an index blog and create a type article demo, participle used to IK participle.

Some of these options are not clear what the meaning, the specific problem in the following code (there are 4), please God to help answer, thank you.

Official Document Link: https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/_index_management_operations.html# _create_an_index_advanced_example

        $params = [' Index ' = ' blog ', ' body ' = = [' Settings ' = [  ' Number_of_shards ' = 1, ' Number_of_replicas ' + 0, ' analysis '                            [' Filter ' = + [///1, two shingle here should be changed to article?                        ' Shingle ' = [' type ' = ' shingle '] ],//2, what does the contents of Char_filter mean?                        including Pre_negs and Post_negs. ' Char_filter ' = [' pre_negs ' = [' type ' = ' = ' Pattern_r Eplace ', ' pattern ' = ' (\\w+) \\s+ (? I:never|no|nothing|nowhere|noone|none|not|havent|has nt|hadnt|cant|couldnt|shouldnt|wont|wouldnt|dont|doesnt|didnt|isnt|arent|aint)) \\b ', ' Repla                    Cement ' = ' ~$1 '        ], ' post_negs ' = [' type ' = ' pattern_replace ', ' Pattern ' = ' \\b ' (? I:never|no|nothing|nowhere|noone|none|not|havent|hasnt|hadnt|cant|cou Ldnt|shouldnt|wont|wouldnt|dont|doesnt|didnt|isnt|arent|aint) \\s+ (\\w+) ', ' Replacement ' =& Gt                        ' $ ~$2 '],//3, Analyzer's content needs to be modified? ' Analyzer ' and ' [' blog ' = [' type ' = ' + ' cus Tom ', ' tokenizer ' = ' standard ', ' filter ' and ' = ' Lowerca                Se ', ' stop ', ' Kstem ']]],                            ' Mappings ' = [' article ' and ' [' _all ' = [ "Analyzer" =&GT "Ik_max_word", "search_analyzer" = "Ik_max_word", "Term_vector"  = "No", "store" = "false"], ' properties '                                = = [' title ' = = ' type ' = ' string ',                                ' Store ' = ' no ', ' term_vector ' = ' with_positions_offsets ',                                 ' Analyzer ' = ' ik_max_word ', ' search_analyzer ' = ' Ik_max_word ',                            ' Include_in_all ' = ' true ', ' boost ' = 9                                ], ' content ' = = [' Type ' = ' string ',                      ' Store ' = ' no ', ' term_vector ' = ' with_positions_offsets ',           ' Analyzer ' = ' ik_max_word ', ' search_analyzer ' = ' Ik_max_word ',                            ' Include_in_all ' = ' true ', ' boost ' = 8                            ],//4, time is only used in the search when the sort used, the following options how to fill?                                ' Updated_at ' = [' type ' = ' = ', ' store ' = = ',                                ' Term_vector ' = ', ' analyzer '                                ' Search_analyzer ' = ', ' include_in_all ' and ', '            ' Boost ' = []]]        ]        ]; $client->indices ()->create ($params);
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.