Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.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
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch 不使用curl的弹性搜索查询_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch 不使用curl的弹性搜索查询,elasticsearch,elasticsearch" /> elasticsearch 不使用curl的弹性搜索查询,elasticsearch,elasticsearch" />

elasticsearch 不使用curl的弹性搜索查询

elasticsearch 不使用curl的弹性搜索查询,elasticsearch,elasticsearch,运行命令: curl -XGET http://127.0.0.1:9200/30556/_search -d '{ "query": { "constant_score" : { "filter" : { "term" : { "portal_type" : "Folder"} } } } }' bin/elasticsearch -f 产生0个结果。输出为: {

运行命令:

curl -XGET http://127.0.0.1:9200/30556/_search -d '{
    "query": {
        "constant_score" : {
            "filter" : {
                "term" : { "portal_type" : "Folder"}
            }
        }
    }
}'
bin/elasticsearch -f
产生0个结果。输出为:

{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
如果是事实,我无法得到任何查询来产生结果

然而,当我使用head插件运行相同的查询时,它工作得很好

我正在Mac OS X上使用elasticsearch 0.20.2。我正在使用以下命令启动elastic search:

curl -XGET http://127.0.0.1:9200/30556/_search -d '{
    "query": {
        "constant_score" : {
            "filter" : {
                "term" : { "portal_type" : "Folder"}
            }
        }
    }
}'
bin/elasticsearch -f
我有什么明显的遗漏吗?似乎我有正确的语法,我没有得到任何错误

映射:

{
  "30556": {
    "portal_catalog": {
      "properties": {
        "CreationDate": {
          "type": "date",
          "format": "dateOptionalTime"
        },
        "Creator": {
          "type": "string"
        },
        "Date": {
          "type": "date",
          "format": "dateOptionalTime"
        },
        "Description": {
          "type": "string"
        },
        "ModificationDate": {
          "type": "date",
          "format": "dateOptionalTime"
        },
        "SearchableText": {
          "type": "string"
        },
        "Title": {
          "type": "string"
        },
        "Type": {
          "type": "string"
        },
        "UID": {
          "type": "string"
        },
        "allowedRolesAndUsers": {
          "type": "string"
        },
        "created": {
          "type": "date",
          "format": "dateOptionalTime"
        },
        "effective": {
          "type": "date",
          "format": "dateOptionalTime"
        },
        "effectiveRange": {
          "dynamic": "true",
          "properties": {
            "effectiveRange1": {
              "type": "date",
              "format": "dateOptionalTime"
            },
            "effectiveRange2": {
              "type": "date",
              "format": "dateOptionalTime"
            }
          }
        },
        "exclude_from_nav": {
          "type": "boolean"
        },
        "expires": {
          "type": "date",
          "format": "dateOptionalTime"
        },
        "getId": {
          "type": "string"
        },
        "getObjPositionInParent": {
          "type": "long"
        },
        "getObjSize": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "is_default_page": {
          "type": "boolean"
        },
        "is_folderish": {
          "type": "boolean"
        },
        "listCreators": {
          "type": "string"
        },
        "meta_type": {
          "type": "string"
        },
        "modified": {
          "type": "date",
          "format": "dateOptionalTime"
        },
        "object_provides": {
          "type": "string"
        },
        "path": {
          "dynamic": "true",
          "properties": {
            "depth": {
              "type": "long"
            },
            "path": {
              "type": "string"
            }
          }
        },
        "portal_type": {
          "type": "string"
        },
        "review_state": {
          "type": "string"
        },
        "sortable_title": {
          "type": "string"
        },
        "total_comments": {
          "type": "long"
        }
      }
    }
  }
}
索引文档示例:

{
        "_index": "30556",
        "_type": "portal_catalog",
        "_id": "30613",
        "_score": 1,
        "_source": {
          "sortable_title": "news",
          "exclude_from_nav": false,
          "meta_type": "ATFolder",
          "Date": "2013-01-14T09:24:56-06:00",
          "CreationDate": "2013-01-14T09:24:56-06:00",
          "path": {
            "depth": 2,
            "path": "/el/news"
          },
          "allowedRolesAndUsers": [
            "Anonymous"
          ],
          "portal_type": "Folder",
          "id": "news",
          "UID": "3116b6c7ec384a9393f238fdde778612",
          "expires": "2499-12-31T00:00:00-06:00",
          "Subject": [],
          "is_folderish": true,
          "is_default_page": false,
          "effectiveRange": {
            "effectiveRange1": "1000-01-01T00:00:00-06:00",
            "effectiveRange2": "2499-12-31T00:00:00-06:00"
          },
          "commentators": [],
          "created": "2013-01-14T09:24:56-06:00",
          "getRawRelatedItems": [],
          "cmf_uid": [],
          "Creator": "admin",
          "end": [],
          "modified": "2013-01-14T09:24:56-06:00",
          "Description": "Site News",
          "ModificationDate": "2013-01-14T09:24:56-06:00",
          "total_comments": 0,
          "in_reply_to": [],
          "getIcon": "",
          "effective": "1000-01-01T00:00:00-06:00",
          "SearchableText": "news  News  Site News ",
          "getObjPositionInParent": 61,
          "object_provides": [
            "collective.syndication.interfaces.ISyndicatable",
            "Products.ATContentTypes.interfaces.folder.IATFolder",
            "Products.CMFCore.interfaces._content.IContentish",
            "z3c.relationfield.interfaces.IHasIncomingRelations",
            "webdav.interfaces.IWriteLock"
          ],
          "last_comment_date": null,
          "review_state": "published",
          "start": [],
          "Type": "Folder",
          "listCreators": [
            "admin"
          ],
          "getId": "news",
          "getObjSize": "1 kB",
          "Title": "News"
        }

尽量使用小写的索引名

它有用吗

如果没有,能否提供索引文档和映射(如果有)

更新: 您使用默认分析器,以便将字段拆分为小写的标记。 未分析TermFilter,因此它不匹配


您可以使用小写的TermFilter或使用已分析的MatchQuery,或者更改映射并将字段设置为未分析。

尝试使用小写索引名

它有用吗

如果没有,能否提供索引文档和映射(如果有)

更新: 您使用默认分析器,以便将字段拆分为小写的标记。 未分析TermFilter,因此它不匹配


您可以使用小写的TermFilter或使用已分析的MatchQuery,或者更改映射并将字段设置为未分析。

我的问题是在使用“pyes”python elasticsearch库时开始的,该库以前可以工作,但现在,我尝试运行的所有查询都不会产生任何结果。因此,我开始尝试使用curl获取结果……我的问题开始于使用“pyes”python elasticsearch库,该库以前可以工作,但现在,我尝试运行的所有查询都不会产生任何结果。所以我开始尝试用curl…更新得到结果。我本打算尽量让问题尽可能简单,但我会用我正在使用的确切用例进行更新。谢谢。更新了。我本打算尽量让问题尽可能简单,但我会用我正在使用的确切用例进行更新。谢谢