1

I index a document like that:

JSONObject jsonObject1 = new JSONObject();
    jsonObject1.put("name_surname", "Cristiano Ronaldo");
    jsonObject1.accumulate("teams", "Sporting Lizbon");
    jsonObject1.accumulate("teams", "Manchester United");
    jsonObject1.accumulate("teams", "Real Madrid");
    jsonObject1.put("2014 rank", 1);

    client.prepareIndex("company", "employee", "1").setSource(jsonObject1.toString()).execute().actionGet();

I can search it and get hit with below query:

  QueryBuilder qb=QueryBuilders.matchQuery("2014 rank", 1);
  SearchResponse searchResponse=client.prepareSearch().setQuery(qb).execute().actionGet();

But wildCardQuery doesn't seem to work:

QueryBuilder qb = QueryBuilders.wildcardQuery("name_surname","*naldo");

I think there is a problem with analyzers when I index it. Is whitespace the problem and if it is how can i fix it?

1 Answer 1

-1

I fixed it and i can use wildCardQuery after i have examined this question.

I use settings below before i index my documents.

Node node = nodeBuilder().client(true).settings(ImmutableSettings.settingsBuilder().loadFromSource(jsonBuilder()
            .startObject()
            .startObject("analysis")
            .startObject("analyzer")
            .startObject("steak")
            .field("type", "custom")
            .field("tokenizer", "standard")
            .field("filter", new String[]{"snowball", "standard", "lowercase"})
            .endObject()
            .endObject()
            .endObject()
            .endObject().string())).clusterName("elasticsearch").node();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.