Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Elasticsearch Python-索引分析器&;搜索分析器_Python_Search_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch,Python,Search,elasticsearch" /> elasticsearch,Python,Search,elasticsearch" />

Elasticsearch Python-索引分析器&;搜索分析器

Elasticsearch Python-索引分析器&;搜索分析器,python,search,elasticsearch,Python,Search,elasticsearch,我正在使用python api- 如何设置和更改索引的索引分析器和标记器?谢谢 我找到了修改索引映射的建议,但是没有关于如何从python中实现这一点的文档 显示n-gram-analyzer的设置,但没有在python中实现它的代码 client.indices.create( index=index, body={ 'settings': { # just one shard, no replicas for testing 'nu

我正在使用python api-

如何设置和更改索引的索引分析器和标记器?谢谢

我找到了修改索引映射的建议,但是没有关于如何从python中实现这一点的文档

显示n-gram-analyzer的设置,但没有在python中实现它的代码

client.indices.create(
    index=index,
    body={
      'settings': {
        # just one shard, no replicas for testing
        'number_of_shards': 1,
        'number_of_replicas': 0,

        # custom analyzer for analyzing file paths
        'analysis': {
          'analyzer': {
            'file_path': {
              'type': 'custom',
              'tokenizer': 'path_hierarchy',
              'filter': ['lowercase']
            }
          }
        }
      }
    },
    # Will ignore 400 errors, remove to ensure you're prompted
    ignore=400
)

检查如果索引已经存在,则使用
ignore=400将导致此请求以静默方式失败。在这种情况下,您可能希望看到一个错误:)@DrTech添加了更多信息。如何使用python实现这一点?