Generated index with malformed mappings and ignores number of shards

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

Settings:

    {
      "settings": {
    "index": {
      "creation_date": "1591776877182",
      "number_of_shards": "5",
      "number_of_replicas": "1",
      "uuid": "c2MwFJRJTK2QLv36DFXqLw",
      "version": {
        "created": "6060099"
      },
      "provided_name": "debug"
    }
      },
      "defaults": {
    "index": {
      "max_inner_result_window": "100",
      "unassigned": {
        "node_left": {
          "delayed_timeout": "1m"
        }
      },
      "max_terms_count": "65536",
      "lifecycle": {
        "name": "",
        "rollover_alias": "",
        "indexing_complete": "false"
      },
      "routing_partition_size": "1",
      "max_docvalue_fields_search": "100",
      "merge": {
        "scheduler": {
          "max_thread_count": "4",
          "auto_throttle": "true",
          "max_merge_count": "9"
        },
        "policy": {
          "reclaim_deletes_weight": "2.0",
          "floor_segment": "2mb",
          "max_merge_at_once_explicit": "30",
          "max_merge_at_once": "10",
          "max_merged_segment": "5gb",
          "expunge_deletes_allowed": "10.0",
          "segments_per_tier": "10.0",
          "deletes_pct_allowed": "33.0"
        }
      },
      "max_refresh_listeners": "1000",
      "max_regex_length": "1000",
      "load_fixed_bitset_filters_eagerly": "true",
      "number_of_routing_shards": "5",
      "write": {
        "wait_for_active_shards": "1"
      },
      "mapping": {
        "coerce": "false",
        "nested_fields": {
          "limit": "50"
        },
        "depth": {
          "limit": "20"
        },
        "ignore_malformed": "false",
        "total_fields": {
          "limit": "1000"
        }
      },
      "source_only": "false",
      "soft_deletes": {
        "enabled": "false",
        "retention": {
          "operations": "0"
        }
      },
      "max_script_fields": "32",
      "query": {
        "default_field": [
          "*"
        ],
        "parse": {
          "allow_unmapped_fields": "true"
        }
      },
      "format": "0",
      "frozen": "false",
      "sort": {
        "missing": [],
        "mode": [],
        "field": [],
        "order": []
      },
      "priority": "1",
      "codec": "default",
      "max_rescore_window": "10000",
      "max_adjacency_matrix_filters": "100",
      "gc_deletes": "60s",
      "optimize_auto_generated_id": "true",
      "max_ngram_diff": "1",
      "translog": {
        "generation_threshold_size": "64mb",
        "flush_threshold_size": "512mb",
        "sync_interval": "5s",
        "retention": {
          "size": "512mb",
          "age": "12h"
        },
        "durability": "REQUEST"
      },
      "auto_expand_replicas": "false",
      "mapper": {
        "dynamic": "true"
      },
      "requests": {
        "cache": {
          "enable": "true"
        }
      },
      "data_path": "",
      "highlight": {
        "max_analyzed_offset": "-1"
      },
      "routing": {
        "rebalance": {
          "enable": "all"
        },
        "allocation": {
          "enable": "all",
          "total_shards_per_node": "-1"
        }
      },
      "search": {
        "slowlog": {
          "level": "TRACE",
          "threshold": {
            "fetch": {
              "warn": "-1",
              "trace": "-1",
              "debug": "-1",
              "info": "-1"
            },
            "query": {
              "warn": "-1",
              "trace": "-1",
              "debug": "-1",
              "info": "-1"
            }
          }
        },
        "throttled": "false"
      },
      "fielddata": {
        "cache": "node"
      },
      "default_pipeline": "_none",
      "max_slices_per_scroll": "1024",
      "shard": {
        "check_on_startup": "false"
      },
      "xpack": {
        "watcher": {
          "template": {
            "version": ""
          }
        },
        "version": "",
        "ccr": {
          "following_index": "false"
        }
      },
      "percolator": {
        "map_unmapped_fields_as_text": "false",
        "map_unmapped_fields_as_string": "false"
      },
      "allocation": {
        "max_retries": "5"
      },
      "refresh_interval": "1s",
      "indexing": {
        "slowlog": {
          "reformat": "true",
          "threshold": {
            "index": {
              "warn": "-1",
              "trace": "-1",
              "debug": "-1",
              "info": "-1"
            }
          },
          "source": "1000",
          "level": "TRACE"
        }
      },
      "compound_format": "0.1",
      "blocks": {
        "metadata": "false",
        "read": "false",
        "read_only_allow_delete": "false",
        "read_only": "false",
        "write": "false"
      },
      "max_result_window": "10000",
      "store": {
        "stats_refresh_interval": "10s",
        "type": "",
        "fs": {
          "fs_lock": "native"
        },
        "preload": []
      },
      "queries": {
        "cache": {
          "enabled": "true"
        }
      },
      "ttl": {
        "disable_purge": "false"
      },
      "warmer": {
        "enabled": "true"
      },
      "max_shingle_diff": "3",
      "query_string": {
        "lenient": "false"
      }
    }
      }
    }

Mappings:

    {
      "mapping": {
        "product": {
          "properties": {
            "alternate": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "categories": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "categories_id": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "category": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "cdn_image": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "date_added": {
              "type": "date"
            },
            "description": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "discount_percent": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "discount_type": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "manufacturer": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "manufacturers_id": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "mappings": {
              "properties": {
                "product": {
                  "properties": {
                    "properties": {
                      "properties": {
                        "alternate": {
                          "properties": {
                            "analyzer": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "categories": {
                          "properties": {
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "category": {
                          "properties": {
                            "analyzer": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "cdn_image": {
                          "properties": {
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "date_added": {
                          "properties": {
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "description": {
                          "properties": {
                            "analyzer": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "discount_percent": {
                          "properties": {
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "manufacturer": {
                          "properties": {
                            "analyzer": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "manufacturers_id": {
                          "properties": {
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "popularity": {
                          "properties": {
                            "null_value": {
                              "type": "long"
                            },
                            "store": {
                              "type": "boolean"
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "product_name": {
                          "properties": {
                            "analyzer": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "fields": {
                              "properties": {
                                "keyword": {
                                  "properties": {
                                    "type": {
                                      "type": "text",
                                      "fields": {
                                        "keyword": {
                                          "type": "keyword",
                                          "ignore_above": 256
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },

Mappings continued:


                        "products_id": {
                          "properties": {
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "products_price": {
                          "properties": {
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "popularity": {
              "type": "float"
            },
            "product_name": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "products_id": {
              "type": "long"
            },
            "products_price": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "products_price_sorter": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "qty_box_status": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "settings": {
              "properties": {
                "analysis": {
                  "properties": {
                    "analyzer": {
                      "properties": {
                        "with_stemmer": {
                          "properties": {
                            "filter": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "tokenizer": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "without_stemmer": {
                          "properties": {
                            "filter": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "tokenizer": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "filter": {
                      "properties": {
                        "autocomplete_filter": {
                          "properties": {
                            "max_gram": {
                              "type": "long"
                            },
                            "min_gram": {
                              "type": "long"
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "english_keywords": {
                          "properties": {
                            "keywords": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "english_possessive_stemmer": {
                          "properties": {
                            "language": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "light_english_stemmer": {
                          "properties": {
                            "language": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "my_stop": {
                          "properties": {
                            "stopwords": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        },
                        "synonym_filter": {
                          "properties": {
                            "synonyms": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            },
                            "type": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "number_of_shards": {
                  "type": "long"
                }
              }
            },
            "tax_class_id": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            }
          }
        }
      }
    }

Whereas if I create an index in my old code with the same params (as the first post) I see the following settings and mappings in kibana:

Settings:

    {
      "settings": {
        "index": {
          "number_of_shards": "1",
          "provided_name": "prf_1",
          "creation_date": "1591021835206",
          "analysis": {
            "filter": {
              "english_keywords": {
                "keywords": [
                  "skinners"
                ],
                "type": "keyword_marker"
              },
              "light_english_stemmer": {
                "type": "stemmer",
                "language": "light_english"
              },
              "synonym_filter": {
                "type": "synonym",
                "synonyms": [
                  "vet, veterinary",
                  "wormer , worming, worm"
                ]
              },
              "english_possessive_stemmer": {
                "type": "stemmer",
                "language": "possessive_english"
              },
              "autocomplete_filter": {
                "type": "edge_ngram",
                "min_gram": "3",
                "max_gram": "10"
              },
              "my_stop": {
                "type": "stop",
                "stopwords": [
                  "and",
                  "is",
                  "the",
                  "18",
                  "x",
                  "with",
                  "36",
                  "0.5ml",
                  "1ml",
                  "ml",
                  "in",
                  "24",
                  "1"
                ]
              }
            },
            "analyzer": {
              "with_stemmer": {
                "filter": [
                  "lowercase",
                  "english_keywords",
                  "english_possessive_stemmer",
                  "light_english_stemmer",
                  "synonym_filter",
                  "my_stop"
                ],
                "type": "custom",
                "tokenizer": "standard"
              },
              "without_stemmer": {
                "filter": [
                  "lowercase",
                  "synonym_filter",
                  "my_stop"
                ],
                "type": "custom",
                "tokenizer": "standard"
              }
            }
          },
          "number_of_replicas": "1",
          "uuid": "CmP7lPYeSQiKjLyEkKmvCg",
          "version": {
            "created": "6050499"
          }
        }
      },
      "defaults": {
        "index": {
          "max_inner_result_window": "100",
          "unassigned": {
            "node_left": {
              "delayed_timeout": "1m"
            }
          },
          "max_terms_count": "65536",
          "routing_partition_size": "1",
          "max_docvalue_fields_search": "100",
          "merge": {
            "scheduler": {
              "max_thread_count": "1",
              "auto_throttle": "true",
              "max_merge_count": "6"
            },
            "policy": {
              "reclaim_deletes_weight": "2.0",
              "floor_segment": "2mb",
              "max_merge_at_once_explicit": "30",
              "max_merge_at_once": "10",
              "max_merged_segment": "5gb",
              "expunge_deletes_allowed": "10.0",
              "segments_per_tier": "10.0",
              "deletes_pct_allowed": "33.0"
            }
          },
          "max_refresh_listeners": "1000",
          "max_regex_length": "1000",
          "load_fixed_bitset_filters_eagerly": "true",
          "number_of_routing_shards": "5",
          "write": {
            "wait_for_active_shards": "1"
          },
          "mapping": {
            "coerce": "false",
            "nested_fields": {
              "limit": "50"
            },
            "depth": {
              "limit": "20"
            },
            "ignore_malformed": "false",
            "total_fields": {
              "limit": "1000"
            }
          },
          "source_only": "false",
          "soft_deletes": {
            "enabled": "false",
            "retention": {
              "operations": "0"
            }
          },
          "max_script_fields": "32",
          "query": {
            "default_field": [
              "*"
            ],
            "parse": {
              "allow_unmapped_fields": "true"
            }
          },
          "format": "0",
          "sort": {
            "missing": [],
            "mode": [],
            "field": [],
            "order": []
          },
          "priority": "1",
          "codec": "default",
          "max_rescore_window": "10000",
          "max_adjacency_matrix_filters": "100",
          "gc_deletes": "60s",
          "optimize_auto_generated_id": "true",
          "max_ngram_diff": "1",
          "translog": {
            "generation_threshold_size": "64mb",
            "flush_threshold_size": "512mb",
            "sync_interval": "5s",
            "retention": {
              "size": "512mb",
              "age": "12h"
            },
            "durability": "REQUEST"
          },
          "auto_expand_replicas": "false",
          "mapper": {
            "dynamic": "true"
          },
          "requests": {
            "cache": {
              "enable": "true"
            }
          },
          "data_path": "",
          "highlight": {
            "max_analyzed_offset": "-1"
          },
          "routing": {
            "rebalance": {
              "enable": "all"
            },
            "allocation": {
              "enable": "all",
              "total_shards_per_node": "-1"
            }
          },
          "search": {
            "slowlog": {
              "level": "TRACE",
              "threshold": {
                "fetch": {
                  "warn": "-1",
                  "trace": "-1",
                  "debug": "-1",
                  "info": "-1"
                },
                "query": {
                  "warn": "-1",
                  "trace": "-1",
                  "debug": "-1",
                  "info": "-1"
                }
              }
            },
            "throttled": "false"
          },
          "fielddata": {
            "cache": "node"
          },
          "default_pipeline": "_none",
          "max_slices_per_scroll": "1024",
          "shard": {
            "check_on_startup": "false"
          },
          "xpack": {
            "watcher": {
              "template": {
                "version": ""
              }
            },
            "version": "",
            "ccr": {
              "following_index": "false"
            }
          },
          "percolator": {
            "map_unmapped_fields_as_text": "false",
            "map_unmapped_fields_as_string": "false"
          },
          "allocation": {
            "max_retries": "5"
          },
          "refresh_interval": "1s",
          "indexing": {
            "slowlog": {
              "reformat": "true",
              "threshold": {
                "index": {
                  "warn": "-1",
                  "trace": "-1",
                  "debug": "-1",
                  "info": "-1"
                }
              },
              "source": "1000",
              "level": "TRACE"
            }
          },
          "compound_format": "0.1",
          "blocks": {
            "metadata": "false",
            "read": "false",
            "read_only_allow_delete": "false",
            "read_only": "false",
            "write": "false"
          },
          "max_result_window": "10000",
          "store": {
            "stats_refresh_interval": "10s",
            "type": "",
            "fs": {
              "fs_lock": "native"
            },
            "preload": []
          },
          "queries": {
            "cache": {
              "enabled": "true"
            }
          },
          "ttl": {
            "disable_purge": "false"
          },
          "warmer": {
            "enabled": "true"
          },
          "max_shingle_diff": "3",
          "query_string": {
            "lenient": "false"
          }
        }
      }
    }

Mappings:

    {
      "mapping": {
        "product": {
          "properties": {
            "alternate": {
              "type": "text",
              "analyzer": "with_stemmer"
            },
            "categories": {
              "type": "integer"
            },
            "categories_id": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "category": {
              "type": "text",
              "analyzer": "with_stemmer"
            },
            "cdn_image": {
              "type": "text"
            },
            "date_added": {
              "type": "date"
            },
            "description": {
              "type": "text",
              "analyzer": "with_stemmer"
            },
            "discount_percent": {
              "type": "float"
            },
            "discount_type": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "manufacturer": {
              "type": "text",
              "analyzer": "without_stemmer"
            },
            "manufacturers_id": {
              "type": "integer"
            },
            "popularity": {
              "type": "double",
              "store": true,
              "null_value": 0
            },
            "product_name": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword"
                }
              },
              "analyzer": "with_stemmer"
            },
            "products_id": {
              "type": "integer"
            },
            "products_price": {
              "type": "float"
            },
            "products_price_sorter": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "qty_box_status": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "tax_class_id": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            }
          }
        }
      }
    }

Remove the "product" key from the mapping. Type names are not supported in 7.x in the create index api

Thanks for the reply, is this what you mean:

{
  "settings": {
    "number_of_shards": 1,
    "analysis": {
      "filter": {
        "autocomplete_filter": {
          "type": "edge_ngram",
          "min_gram": 3,
          "max_gram": 10
        },
        "synonym_filter": {
          "type": "synonym",
          "synonyms": [
            "vet, veterinary",
            "wormer , worming, worm"
          ]
        },
        "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": {
    "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"
      }
    }
  }
}

I just tried that and it produces the same results

EDIT: I forgot to mention I am currently testing it with 6.7 api not 7.x thanks

No wonder no one else has ever had this issue I feel like an absolute idiot, the issue was in my code, I was calling $client->index($params) instead of $client->indices()->create($params) a small mistake of copy and pasting. Sorry for wasting people's time!

Ha right! My comment applied to 7.x.

BTW you should migrate to the latest version if you are starting a new project :slight_smile:

Unfortunately it is an existing live project with a one node cluster meaning upgrading would have down time.
All I am currently trying to do is to improve it's indexing structure and querying for now since we are planning to migrate to brand new servers in September which means I can do the upgrade as part of the migration to avoid any down time. :crossed_fingers:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.