I am using the latest version, 7.15.0, of the python elasticsearch module (but version 6.2.4 for an Elasticsearch server running locally, as this is the version required by the customer I am developing for). But the following create() call:
es.indices.create(
index=es_index_name,
body=configs
)
outputs the deprecation warning:
The 'body' parameter is deprecated for the 'create' API and will be removed in 8.0.0. Instead use API parameters directly. See https://github.com/elastic/elasticsearch-py/issues/1698 for more information
However when I change "body=configs" to just "configs", another deprecation warning pops up as follows:
Using positional arguments for APIs is deprecated and will be disabled in 8.0.0. Instead use only keyword arguments for all APIs. See https://github.com/elastic/elasticsearch-py/issues/1698 for more information
HUH?! Surely it must be one or the other!
So what is the correct incantation to use for this call and not see any deprecation warning? Most examples I have seen use the keyword argument, but they could be out of date.
In case it is relevant, configs is a dictionary comprising:
configs = {
"index": {
"number_of_shards": "1",
"analysis": {
"analyzer": {
"custom_keyword_analyzer" : {
"filter" : [
"lowercase"
],
# "type" : "custom",
"tokenizer" : "keyword"
},
"quicksearch_search_analyzer" : {
"filter" : [
"lowercase"
],
# "type" : "custom",
"tokenizer" : "whitespace"
},
"quicksearch_analyzer" : {
"filter" : [
"lowercase"
],
# "type" : "custom",
"tokenizer" : "ngram_tokenizer"
}
},
"tokenizer" : {
"ngram_tokenizer" : {
"type" : "ngram",
"min_gram" : "2",
"max_gram" : "3",
"token_chars" : [
"digit",
"letter",
"punctuation",
"symbol"
]
}
}
}
}
}