首页 \ 问答 \ Elasticsearch analyzer配置(Elasticsearch analyzer config)

Elasticsearch analyzer配置(Elasticsearch analyzer config)

我想为Elasticsearch中的任何索引设置一个全局分析器。

这些行被添加到elasticsearch.yaml中:

index.analysis.analyzer.ik.type: ik
index.analysis.analyzer.default.type: ik
index.analysis.analyzer.standard.type: ik

重新启动Elasticsearch后,这些行显示在http:// localhost:9200 / _nodes / settings中

index: {
  analysis: {
    analyzer: {
      standard: {
        type: "ik"
      },
      default: {
        type: "ik"
      },
      ik: {
        type: "ik"
      }
    }
  }
}

然后我测试了url http:// localhost:9200 / _analyze?text =时间&analyzer = ik

{
  tokens: [
    {
       token: "时间",
       start_offset: 0,
       end_offset: 2,
       type: "CN_WORD",
       position: 0
    }
  ]
}

它显示IKAnalyzer已启用。 但是,当涉及http:// localhost:9200 / _analyze?text =时间&analyzer = standardhttp:// localhost:9200 / _analyze?text =时间时,将返回“标准”分析器结果:

{
  tokens: [
    {
       token: "时",
       start_offset: 0,
       end_offset: 1,
       type: "<IDEOGRAPHIC>",
       position: 0
    },
    {
       token: "间",
       start_offset: 1,
       end_offset: 2,
       type: "<IDEOGRAPHIC>",
       position: 1
    }
  ]
}

所以我该怎么做?


I want to set a global analyzer for any index in Elasticsearch.

These lines are added into elasticsearch.yaml:

index.analysis.analyzer.ik.type: ik
index.analysis.analyzer.default.type: ik
index.analysis.analyzer.standard.type: ik

After restarting Elasticsearch, these lines are shown in http://localhost:9200/_nodes/settings

index: {
  analysis: {
    analyzer: {
      standard: {
        type: "ik"
      },
      default: {
        type: "ik"
      },
      ik: {
        type: "ik"
      }
    }
  }
}

Then I tested with url http://localhost:9200/_analyze?text=时间&analyzer=ik

{
  tokens: [
    {
       token: "时间",
       start_offset: 0,
       end_offset: 2,
       type: "CN_WORD",
       position: 0
    }
  ]
}

It shows the IKAnalyzer is enabled. However, when it comes to http://localhost:9200/_analyze?text=时间&analyzer=standard or http://localhost:9200/_analyze?text=时间, the "standard" analyzer results are returned:

{
  tokens: [
    {
       token: "时",
       start_offset: 0,
       end_offset: 1,
       type: "<IDEOGRAPHIC>",
       position: 0
    },
    {
       token: "间",
       start_offset: 1,
       end_offset: 2,
       type: "<IDEOGRAPHIC>",
       position: 1
    }
  ]
}

So, what should I do?


原文:https://stackoverflow.com/questions/38412057
更新时间:2022-09-04 17:09

最满意答案

实施您自己的时间轴面板。 它很容易!

面板允许您通常为其子项控制布局。 例如,ItemsControl公开了一个名为ItemsPanel的属性,该属性的类型为ItemsPanelTemplate。 默认情况下,这个ItemsPanelTemplate包含一个垂直StackPanel,但可以用你真棒的时间轴面板覆盖。 它们对任何时间轴的关键是x坐标。

使用下面的代码计算你的x坐标是战斗的一半。 之后,只需确定重叠,您就可以在时间轴上正确堆叠项目。

Avanade Silverlight加速器具有时间轴控制和StackCalendar控件(想想Gannt图表),它非常好用。

public double ScaleDate(DateTime date)
    {
        TimeSpan span = this.StopDate - this.StartDate;
        TimeSpan pos = date - this.StartDate;

        double posDays = double.Parse(pos.Days.ToString());
        double spanDays = double.Parse(span.Days.ToString());
        double x = posDays / spanDays;

        return x;
    }

Implement your own Timeline Panel. Its quite easy!

Panels allow you to control layout generically for its children. The ItemsControl for example exposes a property called ItemsPanel that is of type ItemsPanelTemplate. By default this ItemsPanelTemplate contains a vertical StackPanel but can be overridden with your awesome Timeline Panel. They key to any timeline is the x-coordinate.

Using the code below to calculate your x coordinate is half the battle. After that its just a matter of determining overlap so you can properly stack your items on the timeline.

The Avanade Silverlight Accelerator has both a Timeline Control and a StackCalendar Control (think Gannt Chart) which work very nicely.

public double ScaleDate(DateTime date)
    {
        TimeSpan span = this.StopDate - this.StartDate;
        TimeSpan pos = date - this.StartDate;

        double posDays = double.Parse(pos.Days.ToString());
        double spanDays = double.Parse(span.Days.ToString());
        double x = posDays / spanDays;

        return x;
    }

相关问答

更多
  • 我认为这里的关键是意识到Silverlight默认以60fps的最大帧速率渲染(通过MaxFrameRate属性进行定制)。 这意味着DispatcherTimer ticks每秒最多会触发60次。 此外,所有的渲染工作都发生在UI线程上,因此DispatcherTimer会根据上一张海报中指出的最好的速度触发绘图。 添加三个定时器的结果就是每个事件循环激发“添加数据”方法3次,而不是一次,所以它看起来像你的图表要快得多,但实际上帧速率是大致的一样。 您可以通过一个DispatcherTimer获得相同的效 ...
  • 实施您自己的时间轴面板。 它很容易! 面板允许您通常为其子项控制布局。 例如,ItemsControl公开了一个名为ItemsPanel的属性,该属性的类型为ItemsPanelTemplate。 默认情况下,这个ItemsPanelTemplate包含一个垂直StackPanel,但可以用你真棒的时间轴面板覆盖。 它们对任何时间轴的关键是x坐标。 使用下面的代码计算你的x坐标是战斗的一半。 之后,只需确定重叠,您就可以在时间轴上正确堆叠项目。 Avanade Silverlight加速器具有时间轴控制和S ...
  • WPF应该能够很容易地处理这个问题。 Silverlight可能会工作,但它没有WPF提供的相同硬件加速,因此性能会更低。 实际实施有很多选择。 您可以使用画布并自己渲染。 或者,如果您遇到更新问题,画布网格(仅根据需要更新)可能有助于保留模式渲染系统执行得更好,但我怀疑,使用标准屏幕分辨率,您会遇到任何问题WPF中的这一数量的文本。 WPF should be able to handle this, pretty easily. Silverlight would probably work, but ...
  • 建立声音的频率需要将信号从时域转换到频域。 它将涉及傅立叶变换和随后的输出分析。 如果没有对DSP技术的全面了解,对任何人来说,这都不是一项工作。 如果你不得不问,那么你自己实现这一目标还有很长的路要走。 我推荐第三方库。 这个页面提供了一个从频率检测新手的相当好的视图。 Establishing the frequency of the sound requires converting the signal from the time domain to the frequency domain. It ...
  • 我认为这是对您的问题的一个很好的描述: http : //microapplications.com/blog/archive/2009/04/18/329.aspx 实际上,您可以创建一个包含作业,图像和审计属性的新类,并从DomainService返回它。 在服务器端,你拼凑了一些LINQ代码,它们将从所有3个表中选择相关项。 这只是一个解决方案,你可能还可以在你的selectionchanged处理程序中编写一些代码,只加载与相关作业相关的图像。 I think this is a good desc ...
  • 从Silverlight的角度来看,“嵌入式资源”和“资源”之间的区别在于Silverlight无法访问“嵌入式资源”,因此请勿使用它。 要访问作为“资源”添加到dll程序集的文件,您需要添加程序集的名称加上“; component”作为访问它的Uri的第一个元素: - spellChecker.MainDictionary.LoadAsync(new Uri("/yourProjectName;component/yourDictionary.dic",UriKind.Relative)); 如果您正 ...
  • 我看到您在示例中使用了实际的URL。 我检查了您的网站,没有http://www.sm-testing.co.uk/ClientAccessPolicy.xml文件或http://www.sm-testing.co.uk/crossdomain.xml文件。 没有这些文件中的任何一个( 最好是ClientAccessPolicy.xml,因为另一个是旧的Flash兼容格式并缺少某些功能)Silverlight只会从托管的域中检索文件。 这是一项安全功能,可以阻止Silverlight应用程序在未经许可的情况 ...
  • Silverlight没有同步Socket方法。 您将需要使用Socket.ReceiveAsync方法 。 这里的好例子: 使用套接字将数据推送到Silverlight客户端 。 [编辑]做这样的事情的基本想法: var e = new SocketAsyncEventArgs(); e.Completed += SocketReceiveCompleted; Socket.ReceiveAsync(e); private void SocketReceiveCompleted(object sende ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)