Hello there,
I am trying to move my indexing code from an old code base to a new one, the elasticsearch server that I am using is 6.6.0 and I have tried the following parameters for create index using the official php client (elasticsearch/elasticsearch-php) versions 2.3.2 (because that is what is currently working with the same params), 6.7 (because it is the recommended version if using 6.6) and the latest ^7.1 (because it is the latest) and in all of them the settings and mappings are malformed
Here is my parameters that I pass to the create()
method:
Array
(
[index] => testing
[body] => {"settings":{"number_of_shards":1,"analysis":{"filter":{"autocomplete_filter":{"type":"edge_ngram","min_gram":3,"max_gram":10},"synonym_filter":{"type":"synonym","synonyms":["wormer, worming, worm","xmas => christmas"]},"light_english_stemmer":{"type":"stemmer","language":"light_english"},"english_possessive_stemmer":{"type":"stemmer","language":"possessive_english"},"my_stop":{"type":"stop","stopwords":["and","is","the","18","x","with","36","0.5ml","1ml","ml","in","24","1"]},"english_keywords":{"type":"keyword_marker","keywords":["skinners"]}},"analyzer":{"with_stemmer":{"type":"custom","tokenizer":"standard","filter":["lowercase","english_keywords","english_possessive_stemmer","light_english_stemmer","synonym_filter","my_stop"]},"without_stemmer":{"type":"custom","tokenizer":"standard","filter":["lowercase","synonym_filter","my_stop"]}}}},"mappings":{"product":{"properties":{"product_name":{"type":"text","analyzer":"with_stemmer","fields":{"keyword":{"type":"keyword"}}},"products_id":{"type":"integer"},"manufacturers_id":{"type":"integer"},"categories":{"type":"integer"},"alternate":{"type":"text","analyzer":"with_stemmer"},"description":{"type":"text","analyzer":"with_stemmer"},"cdn_image":{"type":"text"},"category":{"type":"text","analyzer":"with_stemmer"},"manufacturer":{"type":"text","analyzer":"without_stemmer"},"products_price":{"type":"float"},"date_added":{"type":"date"},"discount_percent":{"type":"float"},"popularity":{"null_value":0,"store":true,"type":"double"}}}}}
[type] => product
[client] => Array
(
[curl] => Array
(
[10023] => Array
(
[0] => Content-type: application/json
)
)
)
)
This ignores number_of_shards
setting completely and adds it to my mappings when I check in Kibana the following is what I get in settings and mappings tabs: (I will have to post separately as it exceeds max number of characters here)
I have tried everything and I cannot figure out why the settings and mappings changes when I use my new code base (using Laravel and PHP 7, the old code base is just procedural php uses php elastic package 2.3.2 and runs on PHP 7) I even point my new code base to the same elastic server that has indexes from the old code base and it does the same, mostly I need the number of shards to be one but for some reason it ignores it and put in in the mapping, I tried putting the number of shards in the index
element and added number of replicas but it just puts them both in mappings and ignores my settings.
Any help to see what I am doing wrong would be appreciated as I have been trying everything for the past two days and cannot figure it out. Thanks
PS - Apologies for the very long & numerous posts just thought I should provide as much information as possible