Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.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
Php 如何通过elastica在弹性搜索中查找字符串?_Php_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Elastica - Fatal编程技术网 elasticsearch,elastica,Php,elasticsearch,Elastica" /> elasticsearch,elastica,Php,elasticsearch,Elastica" />

Php 如何通过elastica在弹性搜索中查找字符串?

Php 如何通过elastica在弹性搜索中查找字符串?,php,elasticsearch,elastica,Php,elasticsearch,Elastica,假设我想要一个搜索结果,每个项目的这个特定字段都有一个字符串,例如 标签 例如,我有一个名为description的数据字段,所以我想从结果中得到什么,只有那些在其描述中包含字符串“hashtag”的项,例如 "the english alphabet has 28 letters #hashtag" 因此,上面带有此描述字段的项目应该包含在搜索结果中,因为描述字段值字符串中有一个hashtag字符串 如何在elastica中做到这一点?我应该使用什么过滤或函数?我知道如何使用这些php内置函

假设我想要一个搜索结果,每个项目的这个特定字段都有一个字符串,例如 标签

例如,我有一个名为description的数据字段,所以我想从结果中得到什么,只有那些在其描述中包含字符串“hashtag”的项,例如

"the english alphabet has 28 letters #hashtag"
因此,上面带有此描述字段的项目应该包含在搜索结果中,因为描述字段值字符串中有一个hashtag字符串


如何在elastica中做到这一点?我应该使用什么过滤或函数?

我知道如何使用这些php内置函数,但我说的是elasticsearch/ElasticCheck,它对您有帮助。
<?php
$mystring = 'abc';
$findme   = 'a';
$pos = strpos($mystring, $findme);

// The !== operator can also be used.  Using != would not work as expected
// because the position of 'a' is 0. The statement (0 != false) evaluates 
// to false.
if ($pos !== false) {
     echo "The string '$findme' was found in the string '$mystring'";
         echo " and exists at position $pos";
} else {
     echo "The string '$findme' was not found in the string '$mystring'";
}
?>