Skip to Content

Contributors

Re: elasticsearch configure indexing

Hi Mohamed,

If you use the shopinvader demo app and the nuxtjs template the following index configuration should work for the product:
{"settings": {"analysis": {"char_filter": {"replace": {"type": "mapping", "mappings": ["&=> and "]}}, "filter": {"word_delimiter": {"type": "word_delimiter", "split_on_numerics": false, "split_on_case_change": true, "generate_word_parts": true, "generate_number_parts": true, "catenate_all": true, "preserve_original": true, "catenate_numbers": true}}, "analyzer": {"default": {"type": "custom", "char_filter": ["html_strip", "replace"], "tokenizer": "whitespace", "filter": ["lowercase", "word_delimiter"]}}, "index": {"sort.field": ["main", "id"], "sort.order": ["desc", "asc"]}}}, "mappings": {"properties": {"categories": {"type": "nested", "properties": {"id": {"type": "integer"}, "level": {"type": "integer"}, "name": {"type": "keyword"}, "url_key": {"type": "keyword"}}}, "url_key": {"type": "keyword"}, "variant_attributes": {"properties": {"color": {"type": "text", "fielddata": true}}}, "main": {"type": "boolean"}, "id": {"type": "integer"}, "redirect_url_key": {"type": "keyword"}}}}

For the category, you should set:
{"settings": {"index": {"sort.field": ["id"], "sort.order": ["asc"]}}, "mappings": {"properties": {"url_key": {"type": "keyword"}, "redirect_url_key": {"type": "keyword"}, "id": {"type": "integer"}}}}


In the demo app we use a specific addon to define the products to be exported to elasticsearch: 'sale_channel_search_engine_product'. Therefore on a channel, you must link the channel to a search engine. Once it's done, all the products linked to this sales channel will be exported to elasticsearch. 

image.png
image.png


If you plan to come to the OCA days or Odoo XP I'll be happy to help you configure your env to get everything working.

Regards,

lmi

On Wed, Sep 25, 2024 at 3:42 AM mohamed alkobrosly <notifications@odoo-community.org> wrote:
Dear odoo community.

While trying to install and run shopinvader project, I got an error that elasticsearch is connected successfully but there is no any document.

I tried to make index by hand outside odoo and it succeeded.

I guess the issue is related to configuration index filed which is in Se Index Config model.

The default value for that field is {} but I am sure it must be changed.

Can someone tell me how to set the value for that field please?

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe


by Laurent Mignon - 08:30 - 25 Sep 2024

Reference

  • elasticsearch configure indexing
    Dear odoo community.

    While trying to install and run shopinvader project, I got an error that elasticsearch is connected successfully but there is no any document.

    I tried to make index by hand outside odoo and it succeeded.

    I guess the issue is related to configuration index filed which is in Se Index Config model.

    The default value for that field is {} but I am sure it must be changed.

    Can someone tell me how to set the value for that field please?

    by Mohamed Alkobrosly - 03:42 - 25 Sep 2024