小编Kar*_*yan的帖子

在 html5 日期字段上启用复制/粘贴

能够从文本框中复制值并粘贴到我的 html5 表单中的另一个文本框中。同样的方式我如何从日期字段复制值。

<input type="date" />

我想从一个日期字段复制值并将其粘贴到另一个日期字段。

html javascript

7
推荐指数
1
解决办法
3906
查看次数

ElasticSearch JavaAPI (SearchScroll)- search_context_missing_exception","re​​ason":"找不到 id 的搜索上下文

100k我正在从一个索引中获取多个文档searchScroll,并在所有文档中再添加一个字段100K。然后再次将这些文档插入到另一个新索引中。

我正在使用SearchScrollapi 也正在设置大小,searchSourceBuilder.size(100)我已将大小增加到searchSourceBuilder.size(1000)。在这两种情况下,处理18100文档(当 searchSourceBuilder.size(100) 时)和21098文档(当 searchSourceBuilder.size(1000) 时)后都会出现以下错误。

search_context_missing_exception","reason":"No search context found for id

并且,错误抛出在这一行searchResponse = SearchEngineClient.getInstance().searchScroll(scrollRequest);

请找到我完整的错误堆栈

Exception in thread "main" ElasticsearchStatusException[Elasticsearch exception
[type=search_phase_execution_exception, reason=all shards failed]]; nested: Elas
ticsearchException[Elasticsearch exception [type=search_context_missing_exceptio
n, reason=No search context found for id [388]]];
        at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestR
esponse.java:177)
        at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLeve
lClient.java:573)
        at org.elasticsearch.client.RestHighLevelClient.parseResponseException(R
estHighLevelClient.java:549)
        at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighL
evelClient.java:456)
        at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEn
tity(RestHighLevelClient.java:429)
        at org.elasticsearch.client.RestHighLevelClient.searchScroll(RestHighLev
elClient.java:387)
        at com.es.utility.DocumentIndex.main(DocumentIndex.java:101)
        Suppressed: org.elasticsearch.client.ResponseException: method [GET], …
Run Code Online (Sandbox Code Playgroud)

java elasticsearch elastic-stack

5
推荐指数
1
解决办法
2万
查看次数

Elasticsearch 匹配多个字段,AND 运算符不起作用

我正在尝试使用 AND 运算符从具有多个字段的 elasticsearch 中获取文档

对于以下查询,我期待以下结果

AB-7000-8002-W

但我收到此错误消息 Unrecognized token 'get': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@40d2a7e8; line: 1, column: 5]

 get my_index12/_search {
    "query" : {
        "bool": {
            "should": [
                {
                    "match": {
                        "code": {
                         "query": "AB-5000-6002-AK",
                         "operator": "and"
                        }
                    }
                },
                {
                    "match": {
                        "locale": {
                         "query": "en_US",
                         "operator": "and"
                        }
                    }
                }
            ]
        }
    }
 }
Run Code Online (Sandbox Code Playgroud)

请在下面找到我的索引文件

 {
        "_index": "my_index12",
        "_type": "doc",
        "_id": "2",
        "_score": 1,
        "_source": {
          "code": "AB-7000-8002-W",
          "locale": "en_US"
        }
      }, …
Run Code Online (Sandbox Code Playgroud)

java elasticsearch kibana elastic-stack

4
推荐指数
1
解决办法
6272
查看次数

ElasticSearch Java RestClient - 等待 f 或 [30000] 毫秒后侦听器超时

documents正在100K通过 java 代码查询比文档更多的弹性搜索索引。正在使用RestClient

当我试图获取文件时 Exception in thread "main" java.io.IOException: listener timeout after waiting f or [30000] ms

请找出以下错误:

D:\Karthikeyan\ElasticSearch\ElasticSearch_Tesing\target>java -jar ElasticSearch
Utility-1.0.0-SNAPSHOT-jar-with-dependencies.jar
ERROR StatusLogger No log4j2 configuration file found. Using default configurati
on: logging only errors to the console. Set system property 'log4j2.debug' to sh
ow Log4j2 internal initialization logging.
Jul 13, 2018 2:46:37 PM com.es.utility.DocumentIndex main
INFO: Started Indexing the Document.....
Request --->SearchRequest{searchType=QUERY_THEN_FETCH, indices=[documents], indi
cesOptions=IndicesOptions[id=38, ignore_unavailable=false, allow_no_indices=true
, expand_wildcards_open=true, expand_wildcards_closed=false, allow_aliases_to_mu
ltiple_indices=true, …
Run Code Online (Sandbox Code Playgroud)

java elasticsearch elastic-stack

4
推荐指数
1
解决办法
5625
查看次数

在本地主机中打开 eureka 页面时出现 404 错误

我已经Eureka Server使用 gradle 从 intellij 开始,服务器已按照日志启动并运行。404但使用以下网址在浏览器中出现错误

http://localhost:8761/eureka/

请从intellij控制台找到日志

2020-07-12 13:57:27.988  INFO 24624 --- [           main] c.n.eureka.DefaultEurekaServerContext    : Initializing ...
2020-07-12 13:57:27.990  INFO 24624 --- [           main] c.n.eureka.cluster.PeerEurekaNodes       : Adding new peer nodes [http://localhost:8761/eureka/]
2020-07-12 13:57:28.370  INFO 24624 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2020-07-12 13:57:28.370  INFO 24624 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2020-07-12 13:57:28.370  INFO 24624 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2020-07-12 …
Run Code Online (Sandbox Code Playgroud)

java spring-boot

4
推荐指数
1
解决办法
3897
查看次数

Elasticsearch查询未给出完全匹配

我在下面的匹配查询中搜索elasticsearch,它没有给我确切的匹配,而是给了我更多的无关紧要的匹配。

我正在使用elasticsearch 6.2.3

请在下面找到我的查询

get items/_search
{
   "query" : {
      "match" : {
         "code" : "7000-8900"
      }
   }
}
Run Code Online (Sandbox Code Playgroud)

请找到响应从match查询中获取

7000-8900
7000-8002-WK
7000-8002-W
Run Code Online (Sandbox Code Playgroud)

java elasticsearch kibana elastic-stack

3
推荐指数
2
解决办法
4528
查看次数

org.apache.http.ContentTooLongException:对于配置的缓冲区限制,实体内容太长 [105539255] [104857600]

我正在尝试从我的索引 (ElasticSearch) 中获取索引的 PDF 文档。我已经使用摄取附件处理器插件索引了我的 pdf 文档。共有 2500 份文档与 PDF 附件一起被索引。

现在我通过搜索 PDF 的内容来获取这些 PDF,并得到以下错误。

org.apache.http.ContentTooLongException: entity content is too long [105539255] for the configured buffer limit [104857600]
    at org.elasticsearch.client.HeapBufferedAsyncResponseConsumer.onEntityEnclosed(HeapBufferedAsyncResponseConsumer.java:76)
    at org.apache.http.nio.protocol.AbstractAsyncResponseConsumer.responseReceived(AbstractAsyncResponseConsumer.java:131)
    at org.apache.http.impl.nio.client.MainClientExec.responseReceived(MainClientExec.java:315)
    at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseReceived(DefaultClientExchangeHandlerImpl.java:147)
    at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.responseReceived(HttpAsyncRequestExecutor.java:303)
    at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:255)
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
    at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
    at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
    at java.lang.Thread.run(Thread.java:748)
Exception in thread "main" java.lang.NullPointerException
    at com.es.utility.DocumentSearch.main(DocumentSearch.java:88)
Run Code Online (Sandbox Code Playgroud)

请找到我的 Java API 代码以从 ElasticSearch 中获取文档

private final static String ATTACHMENT = "document_attachment"; …
Run Code Online (Sandbox Code Playgroud)

java elasticsearch kibana elastic-stack

3
推荐指数
1
解决办法
7964
查看次数

Java对象列表按特定对象排序,而不是排序

我有以下JSONArray试图对它进行排序.因此,为了将我的JSONArray转换为ArrayList,然后对它们进行排序并转换回JSONArray.

请找到最初的JSONArray(不在排序顺序中).

[  
   {  

      "code":"TE-7000-8003-W",
      "id":"13342",

   },
   {  
      "code":"TE-7000-8003",
      "id":"13163",
   },
   {  
      "code":"TE-7000-8003-WK",
     "id":"11573",
   },
   {  
      "code":"TE-7000-8003S",
      "id":"11565",

   },
   {  
      "code":"TE-7000-8003-K",
      "id":"11557",
   }
]
Run Code Online (Sandbox Code Playgroud)

请找到我的下面的代码,它将我的JSONArray转换为ArrayList并对它们进行排序.

Item item=null;
List<Item> newItemList = new ArrayList<Item>();
for (int i=0;i<resultJSONArray.length();i++) {
    JSONObject jobj = resultJSONArray.getJSONObject(i);
    item = new Item();
    item.setId(jobj.optString("id"));
    item.setCode(jobj.optString("code"));
    newItemList.add(item);
}

 newItemList
  .stream()
  .sorted((object1, object2) -> object1.getCode().compareTo(object2.getCode()));

Iterator<Item> itr = newItemList.iterator();
while(itr.hasNext()) {
    Item item1=itr.next();
    System.out.println("Item----->"+item1.getCode());
}
Run Code Online (Sandbox Code Playgroud)

以下是输出结果,而不是排序顺序

Item----->TE-7000-8003-W
Item----->TE-7000-8003
Item----->TE-7000-8003-WK
Item----->TE-7000-8003S
Item----->TE-7000-8003-K
Run Code Online (Sandbox Code Playgroud)

我期待如下结果:

Item----->TE-7000-8003
Item----->TE-7000-8003S
Item----->TE-7000-8003-K
Item----->TE-7000-8003-W
Item----->TE-7000-8003-WK
Run Code Online (Sandbox Code Playgroud)

java json java-8

3
推荐指数
1
解决办法
117
查看次数

JAVA 8 - Stream()功能,无法通过添加多个过滤器来打印值

我试图从.stream()via 2 打印值.filter().但价值不是印刷.

一个人.filter()能够打印值.
请在下面找到我的代码.

listProducts.stream()
        .flatMap(listproducts -> listproducts.getProductAttr().stream())
        .flatMap(attr ->attr.getProductAttrValue().stream())
        .filter(av ->  av.getLabel().equalsIgnoreCase("source"))
        .filter(av -> av.getLabel().equalsIgnoreCase("description"))
        .forEachOrdered(av -> System.out.println(av.getValue()));
Run Code Online (Sandbox Code Playgroud)

java filtering java-8 java-stream

2
推荐指数
2
解决办法
98
查看次数

找不到类型返回值的转换器:class org.json.JSONObject

正在编写 Spring Boot 休息服务,以根据 _id (来自 elastic search )从 elastic search 获取产品。我能够打印来自服务的响应,意味着服务能够获取但在转换为 JSONObject 以返回到 UI 时抛出以下错误

No converter found for return value of type: class org.json.JSONObject

请在下面找到我的代码。

public JSONObject getProductById(String id){

    String[] includes = new String[]{id};
    String[] excludes = Strings.EMPTY_ARRAY;
    GetRequest getRequest = new GetRequest(INDEX, TYPE, SOURCE);
    getRequest.routing(id);

    GetResponse getResponse = null;
    try {
        getResponse = restHighLevelClient.get(getRequest);
    } catch (java.io.IOException e){
        e.getLocalizedMessage();
    }

    //GetResponse getResponse = null;

    // create the search request
    SearchRequest searchRequest = new SearchRequest(INDEX); 
    searchRequest.types(TYPE);

    // create …
Run Code Online (Sandbox Code Playgroud)

java rest elasticsearch spring-boot

2
推荐指数
1
解决办法
6360
查看次数